Getting last event in CTrigger.php is very slow

XMLWordPrintable

    • Type: Incident report
    • Resolution: Duplicate
    • Priority: Major
    • None
    • Affects Version/s: 2.0.8rc1
    • Component/s: API (A)

      Getting last event in CTrigger.php is very slow on installations with old PROBLEM triggers, because the query:

      			$lastEvents = DBfetchArrayAssoc(DBselect(
      				'SELECT '.$select.' FROM events e JOIN ('.
      					'SELECT  max(eventid) as lasteventid FROM events e'.
      					' WHERE '.dbConditionInt('e.objectid', $triggerids).
      						' AND '.DBin_node('e.objectid').
      						' AND e.object='.EVENT_SOURCE_TRIGGERS.
      						' AND e.value_changed='.TRIGGER_VALUE_CHANGED_YES.
      					' GROUP BY e.objectid'.
      				') ee ON e.eventid=ee.lasteventid'
      

      parse a lot of data from events table. For example it is slow for triggers which have events with age more 1-2 months.

            Assignee:
            Unassigned
            Reporter:
            Alexey Pustovalov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: