[ZBX-19460] High-load Frontend Query Created: 2021 May 26  Updated: 2024 May 02

Status: Need info
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 5.0.11, 6.0.28
Fix Version/s: None

Type: Problem report Priority: Major
Reporter: Igor Gorbach (Inactive) Assignee: Aleksandrs Petrovs-Gavrilovs
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Causes
Duplicate
Sprint: Support backlog

 Description   

On huge non-partitioned history* tables query like

SELECT itemid,COUNT(*) AS count,AVG(value) AS avg,MIN(value) AS min,MAX(value) AS max,round(1552* MOD(CAST(clock AS UNSIGNED)+3314,8986)/(8986),0) AS i,MAX(clock) AS clock FROM history_uint WHERE itemid='2122261' AND clock>='1620028710' AND clock<='1620037696' GROUP BY itemid,round(1552* MOD(CAST(clock AS UNSIGNED)+3314,8986)/(8986),0);

from function
https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/ui/include/classes/api/managers/CHistoryManager.php#920

running for a  more than 30 seconds and create a huge load on database

I guess, the root reason is max(), min() and avg() functions usage

I guess too, that partitioning could help here, because table will scanning for one or several partitions, not a full table, but

Is it possible to optimize this frontend SQL query some way?

 

 


Generated at Fri Apr 04 20:22:01 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.