-
Problem report
-
Resolution: Unresolved
-
Major
-
None
-
5.0.11, 6.0.28
-
None
-
Support backlog
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?