hydra.sql: add an index for slow queries in production
These queries used to use (jobset, project) based indexes, and the addition of jobset_id makes most of those indexes unusable now.
This commit is contained in:
parent
834793468f
commit
027668f0db
|
@ -682,6 +682,7 @@ create index IndexBuildsOnProject on Builds(project);
|
||||||
create index IndexBuildsOnTimestamp on Builds(timestamp);
|
create index IndexBuildsOnTimestamp on Builds(timestamp);
|
||||||
create index IndexBuildsOnFinishedStopTime on Builds(finished, stoptime DESC);
|
create index IndexBuildsOnFinishedStopTime on Builds(finished, stoptime DESC);
|
||||||
create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC);
|
create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC);
|
||||||
|
create index IndexBuildsOnJobsetIdFinishedId on Builds(id DESC, finished, job, jobset_id);
|
||||||
create index IndexFinishedSuccessfulBuilds on Builds(id DESC, buildstatus, finished, job, jobset_id) where buildstatus = 0 and finished = 1;
|
create index IndexFinishedSuccessfulBuilds on Builds(id DESC, buildstatus, finished, job, jobset_id) where buildstatus = 0 and finished = 1;
|
||||||
create index IndexBuildsOnDrvPath on Builds(drvPath);
|
create index IndexBuildsOnDrvPath on Builds(drvPath);
|
||||||
create index IndexCachedHgInputsOnHash on CachedHgInputs(uri, branch, sha256hash);
|
create index IndexCachedHgInputsOnHash on CachedHgInputs(uri, branch, sha256hash);
|
||||||
|
|
2
src/sql/upgrade-65.sql
Normal file
2
src/sql/upgrade-65.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
-- Add an index like IndexBuildsOnJobFinishedId using jobset_id
|
||||||
|
create index IndexBuildsOnJobsetIdFinishedId on Builds(id DESC, finished, job, jobset_id);
|
Loading…
Reference in a new issue