diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index d53ba11f..b2c61740 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -637,7 +637,7 @@ create index IndexBuildsOnJobset on Builds(project, jobset); create index IndexBuildsOnProject on Builds(project); create index IndexBuildsOnTimestamp on Builds(timestamp); 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) where finished = 0; create index IndexBuildsOnDrvPath on Builds(drvPath); create index IndexCachedHgInputsOnHash on CachedHgInputs(uri, branch, sha256hash); create index IndexCachedGitInputsOnHash on CachedGitInputs(uri, branch, sha256hash); diff --git a/src/sql/upgrade-47.sql b/src/sql/upgrade-47.sql new file mode 100644 index 00000000..3585b6a6 --- /dev/null +++ b/src/sql/upgrade-47.sql @@ -0,0 +1,2 @@ +drop index IndexBuildsOnJobFinishedId; +create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC) where finished = 0;