* 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...
This commit is contained in:
@ -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) {
|
||||
|
@ -289,14 +289,17 @@ QUERY
|
||||
<<QUERY
|
||||
select *
|
||||
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
|
||||
and exists (select 1 from buildresultinfo where id = b.id and buildstatus = 0)
|
||||
) as id
|
||||
from $activeJobs as activeJobs
|
||||
natural join Builds
|
||||
natural join BuildResultInfo
|
||||
where finished = 1 and buildStatus = 0
|
||||
group by project, jobset, job, system
|
||||
) as latest
|
||||
natural join Builds
|
||||
join Builds using (id)
|
||||
QUERY
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user