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

Unnecessary SQL data in Latest Data widget

    XMLWordPrintable

    Details

    • Team:
      Team B
    • Sprint:
      Sprint 39
    • Story Points:
      0.5

      Description

      Latest data widget has popup with previous events information, to show the events Zabbix frontend performs the following query:

      SELECT DISTINCT e.*,er1.r_eventid,er2.c_eventid,er2.correlationid,er2.userid FROM events e LEFT JOIN event_recovery er1 ON er1.eventid=e.eventid LEFT JOIN event_recovery er2 ON er2.r_eventid=e.eventid WHERE e.source='0' AND e.object='0' AND e.objectid='23656' AND e.eventid<='5790292' ORDER BY e.clock DESC,e.eventid DESC LIMIT 20 OFFSET 0
      

      But in this case "event_recovery" table is not required at all. So it is good idea do not JOIN unnecessary tables to avoid performance issues. Small example patch for that:

      Index: include/events.inc.php
      ===================================================================
      --- include/events.inc.php	(revision 83107)
      +++ include/events.inc.php	(working copy)
      @@ -442,7 +442,7 @@
       		$events = API::Event()->get([
       			'source' => EVENT_SOURCE_TRIGGERS,
       			'object' => EVENT_OBJECT_TRIGGER,
      -			'output' => API_OUTPUT_EXTEND,
      +			'output' => ['clock', 'value', 'acknowledged'],
       			'objectids' => [$trigger['triggerid']],
       			'eventid_till' => $trigger['lastEvent']['eventid'],
       			'select_acknowledges' => API_OUTPUT_COUNT,
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: