[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 3/7] duration_estimator: Reorganise inner SQL query to use WITH



We are going to, sometimes, want to ask more complicated questions
about the steps in the job of interest.

No functional change, except perhaps to query optimisation.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/Executive.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 116012b..10fdc8d 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -1057,13 +1057,18 @@ END
     # s J J J # fix perl-mode
 
     my $duration_duration_qtxt= <<END;
-            SELECT sum(finished-started)
-                AS duration
+        WITH tsteps AS 
+        (
+            SELECT *
               FROM steps
              WHERE flight=? AND job=?
-               AND step != 'ts-hosts-allocate'
+        )
+            SELECT sum(finished-started)
+                AS duration
+              FROM tsteps
+             WHERE step != 'ts-hosts-allocate'
 END
-
+       
     my $duration_duration_q = $dbh_tests->prepare($duration_duration_qtxt);
 
     return sub {
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.