diff mbox series

[OSSTEST,44/60] sg-report-job-history (nfc): Drop $hostsq query

Message ID 20200814172205.9624-45-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Speed up sg-report-job-history | expand

Commit Message

Ian Jackson Aug. 14, 2020, 5:21 p.m. UTC
We have eliminated all the users of @hostvarcols before @hostvarcols2
is calculated from the row data.

The query which produces this is very slow and can't be cached.  We
can abolish it now and just use the @hostvarcols2 calculation.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 sg-report-job-history | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/sg-report-job-history b/sg-report-job-history
index 5d913b96..5684ac02 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -147,25 +147,6 @@  END
 END
     $flightsq->execute(@params);
 
-    my $hostsq= db_prepare(<<END);
-        SELECT DISTINCT name
-	 FROM runvars
-	 JOIN flights USING (flight)
-	WHERE ($cond)
-	  AND flight >= COALESCE(
-             (
-	      SELECT flight $fromstuff
-	      LIMIT 1 OFFSET $offset
-	     ), 0)
-     ORDER BY name;
-END
-    $hostsq->execute(@params, @params); # sql text contains $cond twice
-    my @hostvarcols;
-    while (my ($hostvar) = $hostsq->fetchrow_array()) {
-	next unless $hostvar =~ m/(^|_)host$/;
-	push @hostvarcols, $hostvar;
-    }
-
     my $hostq= db_prepare(<<END);
         SELECT name, val
           FROM runvars
@@ -213,8 +194,7 @@  END
     foreach my $ri (@test_rows) {
 	$hostvarnames{$_}=1 foreach keys %{ $ri->{Hosts} }
     }
-    my @hostvarcols2 = sort keys %hostvarnames;
-    die unless "@hostvarcols" eq "@hostvarcols2";
+    my @hostvarcols = sort keys %hostvarnames;
 
     my $osstestverq= db_prepare(<<END);
         SELECT DISTINCT harness