This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> select time, controller, action, time_total, time_rendering, time_db from audit order by time_total desc limit 10 ; | |
+---------------------+--------------------+------------------+------------+----------------+---------+ | |
| time | controller | action | time_total | time_rendering | time_db | | |
+---------------------+--------------------+------------------+------------+----------------+---------+ | |
| 2009-01-12 09:19:24 | TaggerController | new_article_tags | 92.7173 | 0.004 | 0.092 | | |
| 2009-01-12 09:20:50 | ArticlesController | show | 48.3291 | 48.0611 | 0.144 | | |
| 2009-01-12 09:19:28 | ArticlesController | show | 45.4614 | 44.8774 | 0.31201 | | |
| 2009-01-12 09:20:39 | ArticlesController | show | 41.9129 | 41.6489 | 0.208 | | |
| 2009-01-12 09:20:16 | ArticlesController | show | 39.5246 | 38.9085 | 0.38801 | | |
| 2009-01-12 09:19:29 | ArticlesController | show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> p = Page.get(2) | |
~ SELECT "id", "name", "permalink", "created_at", "updated_at" FROM "pages" WHERE ("id" = 2) ORDER BY "id" LIMIT 1 | |
=> #<Page id=2 name="new name2" permalink="tung" body=<not loaded> created_at=#<DateTime: 23565855547/9600,-1/3,2299161> updated_at=#<DateTime: 26511813857/10800,-1/3,2299161>> | |
irb(main):002:0> p.update_attributes('name' => 'new name3', 'body' => 'new body3') | |
~ SELECT "body", "id", "name", "permalink", "created_at", "updated_at" FROM "pages" WHERE ("id" = 2) ORDER BY "id" | |
~ SELECT "id" FROM "pages" WHERE ("name" = 'new name2') ORDER BY "id" LIMIT 1 | |
~ SELECT "id" FROM "pages" WHERE ("permalink" = 'tung') ORDER BY "id" LIMIT 1 | |
=> true | |
irb(main):003:0> p.reload | |
~ SELECT "body", "id", "name", "permalink", "created_at", "updated_at" FROM "pages" WHERE ("id" IN (2)) ORDER BY "id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
Article.find_by_sql("SELECT DISTINCT articles.* FROM articles INNER JOIN taggings ON taggings.taggable_id = articles.id WHERE taggings.tag_id = #{id} AND taggings.taggable_type = 'Article' AND articles.deleted_at IS NULL ORDER BY articles.id DESC LIMIT 5;") | |
## | |
Article.find_by_sql("SELECT DISTINCT articles.* FROM articles INNER JOIN taggings ON taggings.taggable_id = articles.id WHERE taggings.tag_id = #{id} AND taggings.taggable_type = 'Article' AND articles.deleted_at IS NULL ORDER BY articles.score DESC LIMIT 5;") | |
## | |
Article.find_by_sql(["SELECT DISTINCT articles.* FROM articles INNER JOIN taggings ON taggings.taggable_id = articles.id WHERE taggings.tag_id = #{id} AND taggings.taggable_type = 'Article' AND articles.deleted_at IS NULL AND articles.created_at > ? ORDER BY articles.comments_count DESC LIMIT 5;", 5.days.ago]) | |
## | |
Article.find_by_sql(["SELECT DISTINCT articles.* FROM articles INNER JOIN taggings ON taggings.taggable_id = articles.id WHERE taggings.tag_id = #{id} AND tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 location ~* ^/accounts/.*?blog.*$ { | |
37 include /etc/nginx/common/proxy.conf; | |
38 if (!-f $request_filename) { | |
39 rewrite .* /var/bleacherreport/current/rewrite_test.txt; | |
40 # proxy_pass http://bleacherreport_heavy_upstream; | |
41 break; | |
42 } |
NewerOlder