Materialize the number of finished builds
The NrBuilds table tracks the value of ‘select count(*) from Builds where finished = 0’, keeping it up to date via a trigger. This is necessary to make the /all page fast, since otherwise it needs to do a sequential scan on the Builds table.
This commit is contained in:
@ -51,12 +51,12 @@ for (my $n = $schemaVersion; $n < $maxSchemaVersion; $n++) {
|
||||
my @statements = $sql_splitter->split($schema);
|
||||
eval {
|
||||
$dbh->begin_work;
|
||||
sub run {
|
||||
sub run_ {
|
||||
my ($stm) = @_;
|
||||
print STDERR "executing SQL statement: $stm\n";
|
||||
$dbh->do($_);
|
||||
}
|
||||
run($_) foreach @statements;
|
||||
run_($_) foreach @statements;
|
||||
$db->resultset('SchemaVersion')->update({version => $m});
|
||||
$dbh->commit;
|
||||
};
|
||||
|
Reference in New Issue
Block a user