From 12edc4b8e2084b709e08253207b077422a6c85d8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 12 Feb 2010 20:51:24 +0000 Subject: [PATCH] * Speed up the jobstatus query a little bit. --- src/lib/Hydra/Schema/Builds.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 552b8e8e..8fafa686 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -271,13 +271,16 @@ QUERY x.nixExprPath, b.id as statusChangeId, b.timestamp as statusChangeTime from - (select project, jobset, job, system, max(id) as id + (select + (select max(id) from builds b + where + project = activeJobs.project and jobset = activeJobs.jobset + and job = activeJobs.job and system = activeJobs.system + and finished = 1 + ) as id from $activeJobs as activeJobs - natural join Builds - where finished = 1 - group by project, jobset, job, system) - as latest - natural join Builds x + ) as latest + join Builds x using (id) $joinWithStatusChange QUERY );