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

Non-optimal query for getting event notification

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Blocker
    • Resolution: Won't fix
    • Affects Version/s: 2.4.6
    • Fix Version/s: None
    • Component/s: Frontend (F)
    • Labels:

      Description

      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
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: