[ZBX-4202] tr_status.php generates too many queries to the DB Created: 2011 Oct 04 Updated: 2017 May 30 Resolved: 2012 Mar 06 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | None |
Fix Version/s: | 2.0.0rc1 |
Type: | Incident report | Priority: | Minor |
Reporter: | Oleksii Zagorskyi | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | database, performance | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
zabbix php frontend >=1.8.4 |
Issue Links: |
|
Description |
Why for generating one page are performed 200 queries to DB? "SELECT COUNT(DISTINCT e.eventid) as rowscount FROM events e WHERE (e.objectid IN (14770)) AND ((e.objectid BETWEEN 000000000000000 AND 099999999999999)) AND e.object=0 AND e.acknowledged=0 AND (e.value IN (1)) " Could be rewritten as: "SELECT h.hostid FROM hosts h WHERE (h.hostid IN (10070,10169,10222,10229,10216,10220,10235,10733,10234,10175,10170,10362,10117,10689,10069,10745,10171,10209,10214,10204,10225,10183,10208,10211,10210,10205,10172,10173,10206,10185,10177,10176,10236,10232,10370,10212,10174,10223,10207,10219,10215)) AND ((h.hostid BETWEEN 000000000000000 AND 099999999999999)) AND h.status IN (0,1)"? Why use "IN", if inside it is used only one value? |
Comments |
Comment by Toms (Inactive) [ 2012 Feb 23 ] |
At this point multiple "SELECT COUNT(DISTINCT e.eventid) ..." and multiple user data queries resolved. |
Comment by Toms (Inactive) [ 2012 Feb 24 ] |
Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-4202 |
Comment by Toms (Inactive) [ 2012 Feb 24 ] |
One query unfixed. Global structural changes should be considered. |
Comment by Alexander Vladishev [ 2012 Feb 27 ] |
(1) Please review my changes in r25639:25640 <Sasha> all my changes have disappeared <Toms> My fault. I think it is due to misunderstanding with several branches. Nothing to resolve. <Sasha> CLOSED |
Comment by Alexander Vladishev [ 2012 Feb 27 ] |
(2) frontends/php/api/classes/class.cevent.php:176 Here a COUNT() function should be with DISTINCT. <Toms> Resolved in r25654 |
Comment by Alexander Vladishev [ 2012 Feb 27 ] |
(3) frontends/php/api/classes/class.cevent.php:359 Possible undefined variable. DBselect can return NULL. <Toms> Resolved in r25654 |
Comment by Alexander Vladishev [ 2012 Feb 27 ] |
(4) 'groupCount' option should depend on other options. For example hostids, triggerids ... <Toms> Resolved in r25654 |
Comment by Alexander Vladishev [ 2012 Feb 28 ] |
(5) Please rename expand_trigger_description_multiple() function according to codung style. <Toms> Resolved in r25670 <Toms> got the idea. RESOLVED in r25682 |
Comment by Alexander Vladishev [ 2012 Feb 28 ] |
(6) A new function DBfetchFirstArray() isn't used anywhere <Toms> Resolved in r25670 |
Comment by Alexander Vladishev [ 2012 Feb 28 ] |
(7) Please recreate development branch. <Toms> Resolved in r25670 |
Comment by Alexander Vladishev [ 2012 Feb 29 ] |
(8) frontends/php/tr_status.php:447 unused code should not be commented out, but removed. <Toms> RESOLVED in r25682 |
Comment by Alexander Vladishev [ 2012 Feb 29 ] |
(9) new or changed lines should be formatted correctly: <Toms> RESOLVED in r25682 |
Comment by Alexander Vladishev [ 2012 Mar 05 ] |
(10) Long SQL. Please look at it. Time:2.283103 LONG SQL: SELECT DISTINCT t.*,hg.groupid FROM triggers t,functions f,items i,hosts_groups hg WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND hg.hostid=i.hostid AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND (hg.groupid IN ('6')) AND NOT EXISTS ( SELECT ff.functionid FROM functions ff WHERE ff.triggerid=t.triggerid AND EXISTS ( SELECT ii.itemid FROM items ii,hosts hh WHERE ff.itemid=ii.itemid AND hh.hostid=ii.hostid AND ( ii.status<>0 OR hh.status<>0 ) ) ) AND t.status=0 AND ( (t.flags IN ('0','4')) ) ORDER BY lastchange DESC,t.lastchange DESC <Toms> RESOLVED in r.25812 |
Comment by Alexander Vladishev [ 2012 Mar 05 ] |
(11) The trigger dependencies aren't shown correctly <Toms> RESOLVED in r.25812 |
Comment by Alexander Vladishev [ 2012 Mar 05 ] |
(12) Please review my changes in r25785:25786. <Toms> RESOLVED in r.25812 |
Comment by Alexander Vladishev [ 2012 Mar 05 ] |
(13) Undefined variable: description [tr_status.php:478] <Toms> RESOLVED in r.25812 |
Comment by Toms (Inactive) [ 2012 Mar 06 ] |
..F....... |
Comment by Toms (Inactive) [ 2012 Mar 06 ] |
Resolved in r.25831 |