From d8acaf2181517a2a8d065821a1d0e2074a8668ad Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Jul 2015 12:12:44 +0200 Subject: [PATCH] Index BuildSteps on propagatedFrom This significantly speeds up deleting Builds, since it removes the need for a sequential scan on BuildSteps. --- src/sql/hydra.sql | 1 + src/sql/upgrade-36.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/sql/upgrade-36.sql diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 1ade4e38..8752bacc 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -594,6 +594,7 @@ create index IndexBuildProducstOnBuildAndType on BuildProducts(build, type); create index IndexBuildProductsOnBuild on BuildProducts(build); create index IndexBuildStepsOnBusy on BuildSteps(busy) where busy = 1; 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 IndexBuildsOnFinished on Builds(finished) where finished = 0; create index IndexBuildsOnFinishedBusy on Builds(finished, busy) where finished = 0; diff --git a/src/sql/upgrade-36.sql b/src/sql/upgrade-36.sql new file mode 100644 index 00000000..876c1c87 --- /dev/null +++ b/src/sql/upgrade-36.sql @@ -0,0 +1 @@ +create index IndexBuildStepsOnPropagatedFrom on BuildSteps(propagatedFrom) where propagatedFrom is not null;