We've been facing a lot of performance issues, specially related to this query:
SELECT COUNT(DISTINCT t.triggerid) AS cnt,
t.status,
t.value
FROM triggers t
WHERE NOT EXISTS(SELECT f.functionid
FROM functions f JOIN items i ON f.itemid=i.itemid
JOIN hosts h ON i.hostid=h.hostid
WHERE f.triggeid=t.triggerid AND (i.status<>0 OR h.status<>0))
AND t.flags IN (0,4)
GROUP BY t.status,t.value;
It's taking about 1 minute to resolve, and after a vacuum the problem still happens, do you have any ideas? We're using Zabbix 2.4
Timing from Postgres:
cnt | status | value
-------+--------+-------
38088 | 0 | 0
84 | 0 | 1
8756 | 1 | 0
71 | 1 | 1
(4 rows)
Time: 26818.330 ms
SELECT COUNT(DISTINCT t.triggerid) AS cnt,
t.status,
t.value
FROM triggers t
WHERE NOT EXISTS(SELECT f.functionid
FROM functions f JOIN items i ON f.itemid=i.itemid
JOIN hosts h ON i.hostid=h.hostid
WHERE f.triggeid=t.triggerid AND (i.status<>0 OR h.status<>0))
AND t.flags IN (0,4)
GROUP BY t.status,t.value;
It's taking about 1 minute to resolve, and after a vacuum the problem still happens, do you have any ideas? We're using Zabbix 2.4
Timing from Postgres:
cnt | status | value
-------+--------+-------
38088 | 0 | 0
84 | 0 | 1
8756 | 1 | 0
71 | 1 | 1
(4 rows)
Time: 26818.330 ms