From be05ccde67b12a0cb528b47a9cd8847bbb55a642 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 10 Aug 2020 16:10:50 +0100 Subject: [PATCH] sg-report-job-history (nfc): Query hosts runvars in one go Rather than doing one query for each entry in @hostvarcols, do one query for all the relevant runvars. This is quite a bit faster and will enable us to use the cache. This is correct because @hostvarcols was the union of all the host runvars, so this produces the same answers as the individual queries. Signed-off-by: Ian Jackson --- sg-report-job-history | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sg-report-job-history b/sg-report-job-history index fb2930a..5d913b9 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -167,16 +167,19 @@ END } my $hostq= db_prepare(<fetchrow_hashref()) { my $ri= report_run_getinfo($f); $ri->{Hosts} = { }; - foreach my $hostvar (@hostvarcols) { - $hostq->execute($f->{flight}, $f->{job}, $hostvar); - my ($host) = $hostq->fetchrow_array(); + $hostq->execute($f->{flight}, $f->{job}); + while (my ($hostvar,$host) = $hostq->fetchrow_array()) { $ri->{Hosts}{$hostvar} = $host; } -- 2.39.5