The previous query
select count(*) from builds b left join buildsteps s on s.build = b.id where busy = 1 and finished = 0
is suddenly taking several minutes. Probably PostgreSQL decided to use a suboptimal query plan.
E46TNJK6LJK5GSNQM63D647NXTAKXZNG6N6O6B3ETOMDKPGCD6KQC
$c->stash->{nrRunningBuilds} = $c->model('DB::Builds')->search(
{ finished => 0, 'buildsteps.busy' => 1 },
{ join => 'buildsteps', select => ["id"], distinct => 1 })->count();
$c->stash->{nrRunningBuilds} = $c->model('DB')->schema->storage->dbh->selectrow_array(
"select count(distinct build) from buildsteps where busy = 1");