]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
sg-report-host-history: Actually honour $minflight
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 8 Nov 2019 17:00:24 +0000 (17:00 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 20 Nov 2019 17:15:39 +0000 (17:15 +0000)
This seriously speeds up some of the queries.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
sg-report-host-history

index fc51074d640121ec50d71273b8ceb8e7cc18dc8e..d47784d99389694cfce8cb2c2e2fb3991b4599b0 100755 (executable)
@@ -67,6 +67,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 
 our $restrictflight_cond = restrictflight_cond();
 our $flightcond;
+our $minflight;
 
 sub computeflightsrange () {
     if (!$flightlimit) {
@@ -100,7 +101,7 @@ END
          LIMIT 1
 END
     $minflightsq->execute();
-    my ($minflight) = $minflightsq->fetchrow_array();
+    ($minflight,) = $minflightsq->fetchrow_array();
     $minflight //= 0;
 
     $flightcond = "(flight > $minflight)";
@@ -127,10 +128,12 @@ sub mainquery () {
           AND ($valcond)
           AND $flightcond
            AND $restrictflight_cond
+           AND flight > ?
         ORDER BY flight DESC
         LIMIT ($limit * 3 + 100) * ?
 END
 
+    push @params, $minflight;
     push @params, scalar keys %hosts;
 
     print DEBUG "MAINQUERY...\n";