This seriously speeds up some of the queries.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
sg-report-host-history | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sg-report-host-history b/sg-report-host-history
index fc51074d..d47784d9 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -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";
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel