Description
With lots and lots of ports, we ended up with the query in polling/ports.inc.php taking 7 minutes!
SELECT *, I.`port_id` AS `port_id` FROM `ports` AS I LEFT JOIN `ports-state` AS S O:qN I.`port_id` = S.`port_id` WHERE `device_id` = '866;
136 rows in set (7 min 23.28 sec)
^^^^^^^^^^^^^^^
Using a subselect instead, we got it down to a still-ridiculous 22 seconds.
SELECT *, I.`port_id` AS `port_id` FROM (SELECT * FROM `ports` WHERE `device_id` = 866) AS I LEFT JOIN `ports-state` AS S ON I.`port_id` = S.`port_id`;
136 rows in set (22.24 sec)
^^^^^^^^^
Attachments
Activity
Status | Original: Resolved [ 5 ] | New: Closed [ 6 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: Open [ 1 ] | New: Resolved [ 5 ] |
Workflow | Original: classic default workflow [ 12415 ] | New: Observium workflow [ 13080 ] |
better late than never
that fixed long time ago, by remove JOINs -state tables.