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

Slow queries when checking permissions

XMLWordPrintable

      Frontend have few very slow queries when it checking permissions, example:

      SELECT DISTINCT t.triggerid FROM triggers t,functions f,items i,hosts_groups hg,rights r,users_groups ug WHERE ((t.triggerid BETWEEN 000000000000000 AND 099999999999999)) AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND hg.hostid=i.hostid AND r.id=hg.groupid AND r.groupid=ug.usrgrpid AND ug.userid=1 AND r.permission>=2 AND NOT EXISTS( SELECT ff.triggerid FROM function s ff, items ii WHERE ff.triggerid=t.triggerid AND ff.itemid=ii.itemid AND EXISTS( SELECT hgg.groupid FROM hosts_groups hgg, rights rr, users_groups gg
      WHERE hgg.hostid=ii.hostid AND rr.id=hgg.groupid AND rr.groupid=gg.usrgrpid AND gg.userid=1 AND rr.permission<2)) AND (i.hostid IN (12));

      SELECT DISTINCT t.*,h.host,h.hostid FROM triggers t,functions f,items i,hosts_groups hg,rights r,users_groups ug,hosts h WHERE ((t.triggerid BETWEEN 000000000000000 AND 099999999999999)) AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND hg.hostid=i.hostid AND r.id=hg.groupid AND r.groupid=ug.usrgrpid AND ug.userid=5 AND r.permission>=2 AND NOT EXISTS( SELECT ff.triggerid FROM functions ff, items ii WHERE ff.triggerid=t.triggerid AND ff.itemid=ii.itemid AND EXISTS( SELECT hgg.groupid FROM hosts_groups hgg, rights rr, users_groups gg WHERE hgg.hostid=ii.hostid AND rr.id=hgg.groupid AND rr.groupid=gg.usrgrpid AND gg.userid=5 AND rr.permission<2)) 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.value IN (1)) ) AND h.hostid=i.hostid

      This problem is present on almost all pages of configuration and monitoring menu.
      It happens in validate permissions like available_groups, available_hosts functions.

      Using zabbix super-admin account this problem is less noticeable.

            Unassigned Unassigned
            dotneft Alexey Pustovalov
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: