* 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:
parent
9cebf03a45
commit
d8cc0bbb5d
|
@ -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
|
||||
);
|
||||
}
|
||||
|
|
|
@ -434,12 +434,13 @@ create index IndexBuildStepsOnOutpath on BuildSteps(outpath);
|
|||
create index IndexBuildStepsOnOutpathBuild on BuildSteps (outpath, build);
|
||||
create index IndexBuildsOnFinished on Builds(finished);
|
||||
create index IndexBuildsOnIsCurrent on Builds(isCurrent);
|
||||
create index IndexBuildsOnJob on Builds(project, jobset, job);
|
||||
create index IndexBuildsOnJobAndIsCurrent on Builds(project, jobset, job, isCurrent);
|
||||
#create index IndexBuildsOnJob on Builds(project, jobset, job);
|
||||
#create index IndexBuildsOnJobAndIsCurrent on Builds(project, jobset, job, isCurrent);
|
||||
create index IndexBuildsOnJobAndSystem on Builds(project, jobset, job, system);
|
||||
create index IndexBuildsOnJobset on Builds(project, jobset);
|
||||
create index IndexBuildsOnProject on Builds(project);
|
||||
create index IndexBuildsOnTimestamp on Builds(timestamp);
|
||||
create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC);
|
||||
create index IndexCachedGitInputsOnHash on CachedGitInputs(uri, branch, sha256hash);
|
||||
create index IndexCachedGitInputsOnLastSeen on CachedGitInputs(uri, branch, lastSeen);
|
||||
create index IndexCachedSubversionInputsOnUriRevision on CachedSubversionInputs(uri, revision);
|
||||
|
|
Loading…
Reference in a new issue