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

Non-optimal query for getting event notification

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Blocker Blocker
    • None
    • 2.4.6
    • Frontend (F)

      It does not require to use events table in the query at all:

      zabbix=# SELECT a.alertid,mt.description,u.alias,u.name,u.surname,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype
      zabbix-# FROM events e,alerts a
      zabbix-# LEFT JOIN users u ON u.userid=a.userid
      zabbix-# LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid
      zabbix-# WHERE a.eventid='38783839'
      zabbix-# AND a.status='1'
      zabbix-# AND e.eventid = a.eventid
      zabbix-# AND a.alerttype IN (0,1) ORDER BY a.alertid LIMIT 30 OFFSET 0;
      Time: 25413.063 ms
      

      AFTER removing the event table from the request :
      -----------

      zabbix=# SELECT a.alertid,mt.description,u.alias,u.name,u.surname,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype
      zabbix-# FROM alerts a
      zabbix-# LEFT JOIN users u ON u.userid=a.userid
      zabbix-# LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid
      zabbix-# WHERE a.eventid='38783839'
      zabbix-# AND a.status='1'
      zabbix-# AND a.alerttype IN (0,1) ORDER BY a.alertid LIMIT 30 OFFSET 0;
      Time: 3.416 ms
      

            Unassigned Unassigned
            dotneft Alexey Pustovalov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: