Skip to content

Instantly share code, notes, and snippets.

@tongueroo
Created November 25, 2008 18:54
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/29033 to your computer and use it in GitHub Desktop.
Save tongueroo/29033 to your computer and use it in GitHub Desktop.
## on my local dev box
mysql> 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.id IN
(SELECT taggable_id FROM taggings WHERE tag_id = 16 AND taggable_type = 'Article')
ORDER BY articles.id DESC LIMIT 5;
5 rows in set (3.23 sec)
## on production
mysql> 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.id IN
(SELECT taggable_id FROM taggings WHERE tag_id = 16 AND taggable_type = 'Article')
ORDER BY articles.id DESC LIMIT 5;
5 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment