SQL: create better indexes for builds based on the jobset id

These are primarily used by the jobsetOverview renders.
This commit is contained in:
Graham Christensen
2021-06-01 11:23:22 -04:00
parent 719d0a6134
commit a9e4ede006
2 changed files with 8 additions and 0 deletions

5
src/sql/upgrade-75.sql Normal file
View File

@@ -0,0 +1,5 @@
-- These take about 9 minutes in total on a replica of hydra.nixos.org
create index IndexBuildsJobsetIdCurrentUnfinished on Builds(jobset_id) where isCurrent = 1 and finished = 0;
create index IndexBuildsJobsetIdCurrentFinishedStatus on Builds(jobset_id, buildstatus) where isCurrent = 1 and finished = 1;
create index IndexBuildsJobsetIdCurrent on Builds(jobset_id) where isCurrent = 1;