[ZBX-14720] Missing index causing full table scan on escalations table during recovery Created: 2018 Aug 13  Updated: 2024 Apr 10  Resolved: 2018 Sep 19

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 3.4.12, 4.0.0alpha9
Fix Version/s: 4.0.0rc1, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Vladislavs Sokurenko Assignee: Vladislavs Sokurenko
Resolution: Fixed Votes: 0
Labels: escalations, eventid, history, index, recovery, slow
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Causes
caused by ZBXNEXT-3193 Linkage between problem and ok events Closed
Team: Team A
Sprint: Sprint 40, Sprint 41, Sprint 42, Sprint 43
Story Points: 0.5

 Description   

When syncing history and problem gets recovered, then history syncer will do full table scan.

explain select actionid,eventid,escalationid from escalations where eventid=2010;
+------+-------------+-------------+------+---------------+------+---------+------+------+-------------+
| id   | select_type | table       | type | possible_keys | key  | key_len | ref  | rows | Extra       |
+------+-------------+-------------+------+---------------+------+---------+------+------+-------------+
|    1 | SIMPLE      | escalations | ALL  | NULL          | NULL | NULL    | NULL | 1000 | Using where |
+------+-------------+-------------+------+---------------+------+---------+------+------+-------------+
1 row in set (0.00 sec)

In 3.0 it was a little bit better

 explain select actionid,triggerid,itemid from escalations where eventid is not null and actionid=3;
+------+-------------+-------------+------+---------------+---------------+---------+-------+------+-------------+
| id   | select_type | table       | type | possible_keys | key           | key_len | ref   | rows | Extra       |
+------+-------------+-------------+------+---------------+---------------+---------+-------+------+-------------+
|    1 | SIMPLE      | escalations | ref  | escalations_1 | escalations_1 | 8       | const |    1 | Using where |
+------+-------------+-------------+------+---------------+---------------+---------+-------+------+-------------+

Suggested

CREATE INDEX escalations_2 ON escalations (`eventid`);


 Comments   
Comment by Vladislavs Sokurenko [ 2018 Sep 10 ]

Fixed in:
svn://svn.zabbix.com/branches/dev/ZBX-14720

Comment by Vladislavs Sokurenko [ 2018 Sep 13 ]

Fixed in:

  • pre-4.0.0rc1 (trunk) r84825,r84829
Generated at Tue Apr 23 10:47:14 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.