From: Andrew Dunstan Date: Fri, 12 Oct 2012 21:22:05 +0000 (-0700) Subject: Speed up history queries X-Git-Url: https://git.exim.org/buildfarm-server.git/commitdiff_plain/aee3d375b3fd228ea7bdc583b0bb9f3190927a9d Speed up history queries --- diff --git a/cgi-bin/show_history.pl b/cgi-bin/show_history.pl index 288183d..2b822ca 100755 --- a/cgi-bin/show_history.pl +++ b/cgi-bin/show_history.pl @@ -43,34 +43,39 @@ my $latest_personality = $db->selectrow_arrayref(q{ order by effective_date desc limit 1 }, undef, $member); -# we don't really need to do this join, since we only want -# one row from buildsystems. but it means we only have to run one -# query. If it gets heavy we'll split it up and run two - -my $statement = <prepare($systemdata); +$sth->execute($member); +my $sysrow = $sth->fetchrow_hashref; my $statrows=[]; -my $sth=$db->prepare($statement); +$sth=$db->prepare($statement); $sth->execute($member,$branch); while (my $row = $sth->fetchrow_hashref) { + last unless $sysrow; + while (my($k,$v) = each %$sysrow) { $row->{$k} = $v; } $row->{owner_email} =~ s/\@/ [ a t ] /; if ($latest_personality) {