-
Incident report
-
Resolution: Unresolved
-
Trivial
-
7.0.17, 7.4.1, 8.0.0alpha1 (master)
-
S25-W32/33
Zabbix server, Zabbix proxy and frontend can generate such queries in some places where select in batches is not performed:
SELECT * FROM table WHERE id IN (1, 2, ..., 1000) OR id IN (1001, 1002, ..., 2000)
However especially on PostgreSQL they are known to work extremely slow, recent example:
ZBX-26732
They should be simplified so that database engine can analyze them easier and perform fast and efficiently:
SELECT * FROM table WHERE id IN (1, 2, ..., 1000,1001, 1002, ..., 2000)
MySQL can also optimize queries with or conditions into single in but there is not reason to put strain on MySQL to do this work and it's much faster with single in statement. SQLite3 can work old way with or if needed.
Also please see ZBX-24435