Skip to content

Instantly share code, notes, and snippets.

@mroch
Created November 24, 2008 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroch/28603 to your computer and use it in GitHub Desktop.
Save mroch/28603 to your computer and use it in GitHub Desktop.
mysql> explain SELECT u.facebook_uid
-> FROM users u
-> INNER JOIN schedules s ON s.user_id = u.id AND u.id <> 1
-> INNER JOIN schedule_courses sc ON sc.schedule_id = s.id
-> INNER JOIN sections se ON sc.section_id = se.id AND se.course_id = 426;
+----+-------------+-------+--------+---------------------------------------+---------------------------------------+---------+---------------------------------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------------------------------+---------------------------------------+---------+---------------------------------+------+--------------------------+
| 1 | SIMPLE | u | index | PRIMARY | index_users_on_facebook_uid | 258 | NULL | 2 | Using where; Using index |
| 1 | SIMPLE | s | ref | PRIMARY,schedules_user_id_index2 | schedules_user_id_index2 | 5 | scheduleman_lroch.u.id | 2 | Using where; Using index |
| 1 | SIMPLE | sc | ref | index_schedule_courses_on_schedule_id | index_schedule_courses_on_schedule_id | 4 | scheduleman_lroch.s.id | 1 | |
| 1 | SIMPLE | se | eq_ref | PRIMARY,index_sections_on_course_id | PRIMARY | 4 | scheduleman_lroch.sc.section_id | 1 | Using where |
+----+-------------+-------+--------+---------------------------------------+---------------------------------------+---------+---------------------------------+------+--------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment