From 3bb9e17e5cba08f7c9448f9d4c7981d6496d02af Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Jul 2015 15:23:20 +0200 Subject: [PATCH] IndexJobsetEvalsOnJobsetId: Only index jobsets with new builds --- src/sql/hydra.sql | 2 +- src/sql/upgrade-38.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 src/sql/upgrade-38.sql 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;