mysql explain SELECT roles id FROM roles INNER JOIN roles_users ON rol

1
2
3
4
5
6
7
8
mysql> explain SELECT `roles`.id FROM `roles` INNER JOIN `roles_users` ON `roles`.id = `roles_users`.role_id WHERE (`roles`.`id` = 2) AND (`roles_users`.user_id = 1 );
+----+-------------+-------------+-------+------------------------------------------+------------------------------------------+---------+-------------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+-------+------------------------------------------+------------------------------------------+---------+-------------+------+--------------------------+
| 1 | SIMPLE | roles | const | PRIMARY | PRIMARY | 4 | const | 1 | Using index |
| 1 | SIMPLE | roles_users | ref | index_roles_users_on_role_id_and_user_id | index_roles_users_on_role_id_and_user_id | 10 | const,const | 1 | Using where; Using index |
+----+-------------+-------------+-------+------------------------------------------+------------------------------------------+---------+-------------+------+--------------------------+
2 rows in set (0.00 sec)