Skip to content

Instantly share code, notes, and snippets.

@tongueroo
Created November 26, 2008 03:14
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 tongueroo/29254 to your computer and use it in GitHub Desktop.
Save tongueroo/29254 to your computer and use it in GitHub Desktop.
mysql> explain SELECT articles.id, articles.author_id, articles.primary_image_id, articles.hit_count, articles.blurb, articles.teaser, articles.title, articles.permalink, articles.created_at, articles.comments_count FROM articles inner join taggings on tag_id=16 and taggable_type='Article' and articles.id = taggings.taggable_id WHERE articles.deleted_at IS NULL AND articles.created_at > '2008-10-26 00:00:00' ORDER BY articles.id DESC LIMIT 5;
+----+-------------+----------+--------+----------------------------------------------------------------------------------------------------------------------------+---------+---------+------------------------------------------------+------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------+--------+----------------------------------------------------------------------------------------------------------------------------+---------+---------+------------------------------------------------+------+----------------------------------------------+
| 1 | SIMPLE | taggings | ref | index_taggings_on_taggable_id,index_taggings_i1,index_taggings_on_tag_id_and_taggable_type,i2 | i2 | 4 | const | 7936 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | articles | eq_ref | PRIMARY,idx_articles_on_created_at_id,idx_deleted_at_admin_edited_regular_edited_trusted_edited_score,idx_deleted_at_score | PRIMARY | 4 | bleacherreport_production.taggings.taggable_id | 1 | Using where |
+----+-------------+----------+--------+----------------------------------------------------------------------------------------------------------------------------+---------+---------+------------------------------------------------+------+----------------------------------------------+
2 rows in set (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment