Don't use a prepared statement for the active build steps query
Prepared statements are sometimes much slower than unprepared statements, because the planner doesn't have access to the query parameters. This is the case for the active build steps query (in /status), where a prepared statement is three orders of magnitude slower. So disable the use of prepared statements in this case. (Since the query parameters are constant here, it would be nicer if we could tell DBIx::Class to prepare a statement with those parameters fixed. But I don't know an easy way to do so.)
This commit is contained in:
@ -95,11 +95,15 @@ sub timeline :Local {
|
||||
|
||||
sub status :Local {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||
{ 'me.busy' => 1, 'build.busy' => 1 },
|
||||
{ join => [ 'build' ]
|
||||
, order_by => [ 'machine' ]
|
||||
} ) ];
|
||||
$c->model('DB')->storage->dbh_do(sub {
|
||||
my (undef, $dbh) = @_;
|
||||
local $dbh->{pg_server_prepare} = 0;
|
||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||
{ 'me.busy' => 1, 'build.finished' => 0, 'build.busy' => 1 },
|
||||
{ join => [ 'build' ]
|
||||
, order_by => [ 'machine' ]
|
||||
} ) ];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@ sub getBuild {
|
||||
return $build;
|
||||
}
|
||||
|
||||
|
||||
sub getPreviousBuild {
|
||||
my ($c, $build) = @_;
|
||||
return undef if !defined $build;
|
||||
@ -38,6 +39,7 @@ sub getPreviousBuild {
|
||||
return $prevBuild;
|
||||
}
|
||||
|
||||
|
||||
sub getNextBuild {
|
||||
my ($c, $build) = @_;
|
||||
return undef if !defined $build;
|
||||
@ -54,6 +56,7 @@ sub getNextBuild {
|
||||
return $nextBuild;
|
||||
}
|
||||
|
||||
|
||||
sub getPreviousSuccessfulBuild {
|
||||
my ($c, $build) = @_;
|
||||
return undef if !defined $build;
|
||||
@ -71,6 +74,7 @@ sub getPreviousSuccessfulBuild {
|
||||
return $prevBuild;
|
||||
}
|
||||
|
||||
|
||||
sub getBuildStats {
|
||||
my ($c, $builds) = @_;
|
||||
|
||||
|
Reference in New Issue
Block a user