Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5022

select t.* query improvement

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Minor Minor
    • None
    • 1.8.10
    • Frontend (F)
    • Ubuntu 10.04 on both UI and DB. Mariadb 5.2.3 with TokuDB 5.2.7-38674

      When having other problems the current query becomes unusable, but our internally developed version still returns. When not having other problems the internal version is still faster.

      Original query: SELECT t.* FROM triggers t WHERE ((t.triggerid BETWEEN 100000000000000 AND 199999999999999)) 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 EXISTS( SELECT e.eventid FROM events e WHERE e.objectid=t.triggerid AND e.object=0 AND e.value=1 AND e.acknowledged=0) AND ((t.value=1) OR ((t.value=0) AND (t.lastchange>1334175861))) ORDER BY t.description ASC;

      Suggested query: SELECT distinct t.* FROM triggers t, events e WHERE ((t.triggerid BETWEEN 100000000000000 AND 199999999999999)) AND NOT EXISTS ( SELECT ff.functionid FROM functions ff, items ii, hosts hh where ff.triggerid=t.triggerid AND ff.itemid=ii.itemid AND hh.hostid=ii.hostid AND ( ii.status<>0 OR hh.status<>0 ) ) AND t.status=0 and e.objectid=t.triggerid and e.object=0 and e.value=1 and e.acknowledged=0 AND ((t.value=1) OR ((t.value=0) AND (t.lastchange>1334175861))) ORDER BY t.description ASC;

            Unassigned Unassigned
            lufthans Hans Kugler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: