Zabbix uses the next query for getting overview by trigger priority and status:

      mysql> explain SELECT t.priority,t.value,count(DISTINCT t.triggerid) AS cnt FROM triggers t WHERE t.triggerid BETWEEN '13040' AND '13045' OR t.triggerid BETWEEN '26416' AND '26421' OR t.triggerid BETWEEN '26659' AND '26664' OR t.triggerid BETWEEN '26692' AND '26697' GROUP BY t.priority,t.value;
      +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------------+
      | id | select_type | table | type  | possible_keys | key     | key_len | ref  | rows | Extra                       |
      +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------------+
      |  1 | SIMPLE      | t     | range | PRIMARY       | PRIMARY | 8       | NULL |    4 | Using where; Using filesort |
      +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------------+
      1 row in set (0.01 sec)
      

      The query is very slow when an installation has more than 1 million triggers.

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

              Created:
              Updated:
              Resolved: