MariaDB [zabbix_proxy]> explain select pp.item_preprocid,pp.itemid,pp.type,pp.params,pp.step,h.hostid,pp.error_handler,pp.error_handler_params from item_preproc pp,items i,hosts h where pp.itemid=i.itemid and i.hostid=h.hostid and (h.proxy_hostid is null or i.type in (5,15,18)) and h.status in (0,1) and i.flags<>2; +------+-------------+-------+------+-------------------------+----------------+---------+-----------------------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+-------------+-------+------+-------------------------+----------------+---------+-----------------------+------+-------------+ | 1 | SIMPLE | h | ALL | PRIMARY,hosts_2,hosts_3 | NULL | NULL | NULL | 355 | Using where | | 1 | SIMPLE | i | ref | PRIMARY,items_1 | items_1 | 8 | zabbix_proxy.h.hostid | 275 | Using where | | 1 | SIMPLE | pp | ref | item_preproc_1 | item_preproc_1 | 8 | zabbix_proxy.i.itemid | 1 | | +------+-------------+-------+------+-------------------------+----------------+---------+-----------------------+------+-------------+ 3 rows in set (0.001 sec) MariaDB [zabbix_proxy]> explain select i.itemid, i.hostid, i.status, i.type, i.value_type, i.key_, i.snmp_oid, i.ipmi_sensor, i.delay, i.trapper_hosts, i.logtimefmt, i.params, ir.state, i.authtype, i.username, i.password, i.publickey, i.privatekey, i.flags, i.interfaceid, ir.lastlogsize, ir.mtime, i.history, i.trends, i.inventory_link, i.valuemapid, i.units, ir.error, i.jmx_endpoint, i.master_itemid, i.timeout, i.url, i.query_fields, i.posts, i.status_codes, i.follow_redirects, i.post_type, i.http_proxy, i.headers, i.retrieve_mode, i.request_method, i.output_format, i.ssl_cert_file, i.ssl_key_file, i.ssl_key_password, i.verify_peer, i.verify_host, i.allow_traps, i.templateid, null from items i inner join hosts h on i.hostid=h.hostid join item_rtdata ir on i.itemid=ir.itemid where h.status in (0,1) and i.flags<>2; +------+-------------+-------+--------+-----------------+---------+---------+-----------------------+------+--------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+-------------+-------+--------+-----------------+---------+---------+-----------------------+------+--------------------------+ | 1 | SIMPLE | h | range | PRIMARY,hosts_2 | hosts_2 | 4 | NULL | 346 | Using where; Using index | | 1 | SIMPLE | i | ref | PRIMARY,items_1 | items_1 | 8 | zabbix_proxy.h.hostid | 275 | Using where | | 1 | SIMPLE | ir | eq_ref | PRIMARY | PRIMARY | 8 | zabbix_proxy.i.itemid | 1 | | +------+-------------+-------+--------+-----------------+---------+---------+-----------------------+------+--------------------------+ 3 rows in set (0.001 sec)