{"action":"created","issue":{"url":"https://api.github.com/repos/librenms/librenms/issues/2437","labels_url":"https://api.github.com/repos/librenms/librenms/issues/2437/labels{/name}","comments_url":"https://api.github.com/repos/librenms/librenms/issues/2437/comments","events_url":"https://api.github.com/repos/librenms/librenms/issues/2437/events","html_url":"https://github.com/librenms/librenms/pull/2437","id":117224895,"number":2437,"title":"Eventlog query now uses event_id as already indexed","user":{"login":"laf","id":3941142,"avatar_url":"https://avatars.githubusercontent.com/u/3941142?v=3","gravatar_id":"","url":"https://api.github.com/users/laf","html_url":"https://github.com/laf","followers_url":"https://api.github.com/users/laf/followers","following_url":"https://api.github.com/users/laf/following{/other_user}","gists_url":"https://api.github.com/users/laf/gists{/gist_id}","starred_url":"https://api.github.com/users/laf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laf/subscriptions","organizations_url":"https://api.github.com/users/laf/orgs","repos_url":"https://api.github.com/users/laf/repos","events_url":"https://api.github.com/users/laf/events{/privacy}","received_events_url":"https://api.github.com/users/laf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/librenms/librenms/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/librenms/librenms/labels/WebUI","name":"WebUI","color":"99CCFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-16T21:43:55Z","updated_at":"2015-11-16T21:53:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/librenms/librenms/pulls/2437","html_url":"https://github.com/librenms/librenms/pull/2437","diff_url":"https://github.com/librenms/librenms/pull/2437.diff","patch_url":"https://github.com/librenms/librenms/pull/2437.patch"},"body":"Fix #2435 \r\n\r\nevent_id is already indexed:\r\n\r\nPRIMARY KEY (`event_id`),\r\n\r\n```sql\r\nmysql> EXPLAIN SELECT COUNT(DATETIME) FROM eventlog AS E LEFT JOIN devices AS D ON E.host=D.device_id;\r\n+----+-------------+-------+--------+---------------+---------+---------+-----------------+------+-------------+\r\n| id | select_type | table | type   | possible_keys | key     | key_len | ref             | rows | Extra       |\r\n+----+-------------+-------+--------+---------------+---------+---------+-----------------+------+-------------+\r\n|  1 | SIMPLE      | E     | ALL    | NULL          | NULL    | NULL    | NULL            |   72 |             |\r\n|  1 | SIMPLE      | D     | eq_ref | PRIMARY       | PRIMARY | 4       | librenms.E.host |    1 | Using index |\r\n+----+-------------+-------+--------+---------------+---------+---------+-----------------+------+-------------+\r\n```\r\nto\r\n```sql\r\nmysql> EXPLAIN SELECT COUNT(event_id) FROM eventlog AS E LEFT JOIN devices AS D ON E.host=D.device_id;\r\n+----+-------------+-------+--------+---------------+---------+---------+-----------------+------+-------------+\r\n| id | select_type | table | type   | possible_keys | key     | key_len | ref             | rows | Extra       |\r\n+----+-------------+-------+--------+---------------+---------+---------+-----------------+------+-------------+\r\n|  1 | SIMPLE      | E     | index  | NULL          | host    | 4       | NULL            |   72 | Using index |\r\n|  1 | SIMPLE      | D     | eq_ref | PRIMARY       | PRIMARY | 4       | librenms.E.host |    1 | Using index |\r\n+----+-------------+-------+--------+---------------+---------+---------+-----------------+------+-------------+\r\n```"},"comment":{"url":"https://api.github.com/repos/librenms/librenms/issues/comments/157182186","html_url":"https://github.com/librenms/librenms/pull/2437#issuecomment-157182186","issue_url":"https://api.github.com/repos/librenms/librenms/issues/2437","id":157182186,"user":{"login":"LibreNMS-CI","id":12872343,"avatar_url":"https://avatars.githubusercontent.com/u/12872343?v=3","gravatar_id":"","url":"https://api.github.com/users/LibreNMS-CI","html_url":"https://github.com/LibreNMS-CI","followers_url":"https://api.github.com/users/LibreNMS-CI/followers","following_url":"https://api.github.com/users/LibreNMS-CI/following{/other_user}","gists_url":"https://api.github.com/users/LibreNMS-CI/gists{/gist_id}","starred_url":"https://api.github.com/users/LibreNMS-CI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LibreNMS-CI/subscriptions","organizations_url":"https://api.github.com/users/LibreNMS-CI/orgs","repos_url":"https://api.github.com/users/LibreNMS-CI/repos","events_url":"https://api.github.com/users/LibreNMS-CI/events{/privacy}","received_events_url":"https://api.github.com/users/LibreNMS-CI/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T21:53:15Z","updated_at":"2015-11-16T21:53:15Z","body":"Auto-Deploy finished, Test PR at http://2437.ci.librenms.org or https://2437.ci.librenms.org \n"}}