From d8cc0bbb5db11cbf18633c7be123e96a630e78ab Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 12 Feb 2010 14:49:32 +0000 Subject: [PATCH] * Make the "latest succeeded" query (used by the "latest" channel) faster, from about 4.5s to 1.0s for the global "latest" channel. Note that the query is only fast if the "IndexBuildsOnJob" and "IndexBuildsOnJobAndIsCurrent" indices are dropped - if they exist, PostgreSQL will use those instead of the more efficient "IndexBuildsOnJobFinishedId" index. Looks like a bug in the planner to me... --- src/lib/Hydra/Helper/CatalystUtils.pm | 2 +- src/lib/Hydra/Schema/Builds.pm | 15 +++++++++------ src/sql/hydra.sql | 5 +++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index d4cf3f83..7de3a8ee 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -65,7 +65,7 @@ sub getChannelData { my ($c, $builds) = @_; my @builds2 = joinWithResultInfo($c, $builds) - ->search_literal("exists (select 1 from buildproducts where build = me.id and type = 'nix-build')"); + ->search_literal("exists (select 1 from buildproducts where build = resultInfo.id and type = 'nix-build')"); my @storePaths = (); foreach my $build (@builds2) { diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index e2ecbdbb..552b8e8e 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -289,14 +289,17 @@ QUERY <