Index BuildSteps on propagatedFrom

This significantly speeds up deleting Builds, since it removes the
need for a sequential scan on BuildSteps.
This commit is contained in:
Eelco Dolstra 2015-07-08 12:12:44 +02:00
parent bbee81efae
commit d8acaf2181
2 changed files with 2 additions and 0 deletions

View file

@ -594,6 +594,7 @@ create index IndexBuildProducstOnBuildAndType on BuildProducts(build, type);
create index IndexBuildProductsOnBuild on BuildProducts(build); create index IndexBuildProductsOnBuild on BuildProducts(build);
create index IndexBuildStepsOnBusy on BuildSteps(busy) where busy = 1; create index IndexBuildStepsOnBusy on BuildSteps(busy) where busy = 1;
create index IndexBuildStepsOnDrvPath on BuildSteps(drvpath); create index IndexBuildStepsOnDrvPath on BuildSteps(drvpath);
create index IndexBuildStepsOnPropagatedFrom on BuildSteps(propagatedFrom) where propagatedFrom is not null;
create index IndexBuildStepOutputsOnPath on BuildStepOutputs(path); create index IndexBuildStepOutputsOnPath on BuildStepOutputs(path);
create index IndexBuildsOnFinished on Builds(finished) where finished = 0; create index IndexBuildsOnFinished on Builds(finished) where finished = 0;
create index IndexBuildsOnFinishedBusy on Builds(finished, busy) where finished = 0; create index IndexBuildsOnFinishedBusy on Builds(finished, busy) where finished = 0;

1
src/sql/upgrade-36.sql Normal file
View file

@ -0,0 +1 @@
create index IndexBuildStepsOnPropagatedFrom on BuildSteps(propagatedFrom) where propagatedFrom is not null;