diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 3d22d942..3d225cf1 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -623,4 +623,4 @@ create index IndexReleaseMembersOnBuild on ReleaseMembers(build); create index IndexBuildsOnKeep on Builds(keep) where keep = 1; -- To get the most recent eval for a jobset. -create index IndexJobsetEvalsOnJobsetId on JobsetEvals(project, jobset, hasNewBuilds, id desc); +create index IndexJobsetEvalsOnJobsetId on JobsetEvals(project, jobset, id desc) where hasNewBuilds = 1; diff --git a/src/sql/upgrade-38.sql b/src/sql/upgrade-38.sql new file mode 100644 index 00000000..0f4b207e --- /dev/null +++ b/src/sql/upgrade-38.sql @@ -0,0 +1,2 @@ +drop index IndexJobsetEvalsOnJobsetId; +create index IndexJobsetEvalsOnJobsetId on JobsetEvals(project, jobset, id desc) where hasNewBuilds = 1;