Skip to content

Instantly share code, notes, and snippets.

@cchandler
Created September 23, 2009 08:04
Show Gist options
  • Save cchandler/191820 to your computer and use it in GitHub Desktop.
Save cchandler/191820 to your computer and use it in GitHub Desktop.
mysql> explain SELECT `groups`.* FROM `groups` INNER JOIN `memberships` ON `groups`.id = `memberships`.group_id WHERE ((`memberships`.user_id = 653));
+----+-------------+-------------+--------+---------------+---------+---------+----------------------------------------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+--------+---------------+---------+---------+----------------------------------------------+------+-------------+
| 1 | SIMPLE | memberships | ALL | NULL | NULL | NULL | NULL | 100 | Using where |
| 1 | SIMPLE | groups | eq_ref | PRIMARY | PRIMARY | 4 | simplewants_development.memberships.group_id | 1 | |
+----+-------------+-------------+--------+---------------+---------+---------+----------------------------------------------+------+-------------+
2 rows in set (0.00 sec)
---
mysql> explain SELECT `users`.* FROM `users` INNER JOIN `memberships` ON `users`.id = `memberships`.user_id WHERE ((`memberships`.group_id = 449));
+----+-------------+-------------+--------+---------------+---------+---------+---------------------------------------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+--------+---------------+---------+---------+---------------------------------------------+------+-------------+
| 1 | SIMPLE | memberships | ALL | NULL | NULL | NULL | NULL | 100 | Using where |
| 1 | SIMPLE | users | eq_ref | PRIMARY | PRIMARY | 4 | simplewants_development.memberships.user_id | 1 | |
+----+-------------+-------------+--------+---------------+---------+---------+---------------------------------------------+------+-------------+
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment