Details
-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
None
-
Ubuntu 20.04.3 LTS
MySQL 8.0
Description
chart.php is taking time to load(in some cases, it continues to load) and on checking the browser(Under network), TTFB is too high(~1min).
On database side, I am seeing one slow query which is generating 1000+ rows.
- Time: 2022-04-20T05:17:58.519268Z
- User@Host: zabbix[zabbix] @ localhost [] Id: 11591550
- Query_time: 7.931072* Lock_time: 0.000177* Rows_sent: 1083 Rows_examined: 163613*
SET timestamp=1650431870;
SELECT itemid,COUNTAS count,AVG(value) AS avg,MIN(value) AS min,MAX(value) AS max,round(1082* MOD(CAST(clock AS UNSIGNED)+153730,172800)/(172800),0) AS i,MAX(clock) AS clock FROM history_uint WHERE itemid='1091147' AND clock>='1650259070' AND clock<='1650431870' GROUP BY itemid,round(1082* MOD(CAST(clock AS UNSIGNED)+153730,172800)/(172800),0);
- Query_time: 7.931072* Lock_time: 0.000177* Rows_sent: 1083 Rows_examined: 163613*
Can you please guide what best can be done here to avoid this issue?
Screenshot attached( Showing TTFB (time to first byte) is 1 min).