From aee3d375b3fd228ea7bdc583b0bb9f3190927a9d Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Fri, 12 Oct 2012 14:22:05 -0700 Subject: [PATCH] Speed up history queries --- cgi-bin/show_history.pl | 49 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) 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) { -- 2.30.2