Skip to content

Instantly share code, notes, and snippets.

@tongueroo
Created November 26, 2008 03:28
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/29260 to your computer and use it in GitHub Desktop.
Save tongueroo/29260 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 WHERE articles.deleted_at IS NULL AND articles.created_at > '2008-10-26 00:00:00' AND articles.id IN (SELECT taggable_id FROM taggings WHERE tag_id = 16 AND taggable_type = 'Article') ORDER BY articles.id DESC LIMIT 5 \G
*************************** 1. row ***************************
id: 1
select_type: PRIMARY
table: articles
type: ref
possible_keys: idx_articles_on_created_at_id,idx_deleted_at_admin_edited_regular_edited_trusted_edited_score,idx_deleted_at_score,index_articles_on_deleted_at
key: idx_deleted_at_admin_edited_regular_edited_trusted_edited_score
key_len: 9
ref: const
rows: 45335
Extra: Using where; Using filesort
*************************** 2. row ***************************
id: 2
select_type: DEPENDENT SUBQUERY
table: taggings
type: index_subquery
possible_keys: index_taggings_on_taggable_id,index_taggings_i1,index_taggings_on_tag_id_and_taggable_type,i2
key: index_taggings_i1
key_len: 775
ref: func,const,const
rows: 1
Extra: Using index; Using where
2 rows in set (0.01 sec)
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment