-
Incident report
-
Resolution: Fixed
-
Minor
-
1.8.16rc1, 2.0.3rc1, 2.1.0
In last sql query we use select for multiple itemids and then we calculate min clock for specified itemids.
We can simplify query - use MIN(clock) and select min clock at once.
For example:
Index: graphs.inc.php
===================================================================
— graphs.inc.php (revision 29944)
+++ graphs.inc.php (working copy)
@@ -266,10 +266,9 @@
}
$res = DBselect(
- 'SELECT ht.itemid,MIN(ht.clock) AS min_clock'.
+ 'SELECT MIN(ht.clock) AS min_clock'.
' FROM '.$sql_from.' ht'. - ' WHERE '.DBcondition('ht.itemid', $itemids).
- ' GROUP BY ht.itemid'
+ ' WHERE '.DBcondition('ht.itemid', $itemids)
);
while ($min_tmp = DBfetch($res)) {
$min = (is_null($min)) ? $min_tmp['min_clock'] : min($min, $min_tmp['min_clock']);