hydra/src/sql/upgrade-30.sql
Eelco Dolstra d9a5143fcb Use partial indexes
There is no point in indexing rows with common column values like
"finished = 1", since those are the majority of the table. Only the
exceptions ("finished = 0") are interesting. Having smaller tables
should make updates/insertions faster.
2014-09-30 15:44:08 +02:00

17 lines
940 B
SQL

drop index IndexBuildStepsOnBusy;
drop index IndexBuildStepsOnDrvpathTypeBusyStatus;
drop index IndexBuildsOnFinished;
drop index IndexBuildsOnFinishedBusy;
drop index IndexBuildsOnIsCurrent;
drop index IndexBuildsOnJobsetIsCurrent;
drop index IndexBuildsOnJobIsCurrent;
drop index IndexBuildsOnKeep;
create index IndexBuildStepsOnBusy on BuildSteps(busy) where busy = 1;
create index IndexBuildStepsOnDrvPath on BuildSteps(drvpath);
create index IndexBuildsOnFinished on Builds(finished) where finished = 0;
create index IndexBuildsOnFinishedBusy on Builds(finished, busy) where finished = 0;
create index IndexBuildsOnIsCurrent on Builds(isCurrent) where isCurrent = 1;
create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent) where isCurrent = 1;
create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent) where isCurrent = 1;
create index IndexBuildsOnKeep on Builds(keep) where keep = 1;