Skip to content

Instantly share code, notes, and snippets.

@Flameeyes
Created January 4, 2015 19:50
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 Flameeyes/d220dfc0441677ed4385 to your computer and use it in GitHub Desktop.
Save Flameeyes/d220dfc0441677ed4385 to your computer and use it in GitHub Desktop.
Queries for a single post fetch from Typo :(
Started GET "/2015/01/blabhalbhalbha" for 127.0.0.1 at 2015-01-04 11:46:31 -0800
Processing by ArticlesController#redirect as HTML
Parameters: {"from"=>"2015/01/blabhalbhalbha"}
Trigger Load (0.8ms) SELECT "triggers".* FROM "triggers" WHERE (due_at <= '2015-01-04 19:46:31.560203')
Blog Load (0.8ms) SELECT "blogs".* FROM "blogs" ORDER BY id LIMIT 1
(0.3ms) SELECT COUNT(*) FROM "users"
Article Load (4.4ms) SELECT "contents".* FROM "contents" WHERE "contents"."type" IN ('Article') AND "contents"."published" = 't' AND "contents"."permalink" = 'blabhalbhalbha' AND ("contents"."published_at" BETWEEN '2015-01-01 00:00:00.000000' AND '2015-01-31 23:59:59.000000') ORDER BY published_at DESC LIMIT 1
#<Comment:0x000b98b705dd30> entering state Unclassified
TextFilter Load (0.4ms) SELECT "text_filters".* FROM "text_filters" WHERE "text_filters"."id" = 2 LIMIT 1
CACHE (0.0ms) SELECT "blogs".* FROM "blogs" ORDER BY id LIMIT 1
Category Load (2.2ms) SELECT "categories".* FROM "categories" INNER JOIN "categorizations" ON "categories"."id" = "categorizations"."category_id" WHERE "categorizations"."article_id" = 6251 ORDER BY name ASC
Tag Load (2.3ms) SELECT "tags".* FROM "tags" INNER JOIN "articles_tags" ON "tags"."id" = "articles_tags"."tag_id" WHERE "articles_tags"."article_id" = 6251
Comment Load (1.5ms) SELECT "feedback".* FROM "feedback" WHERE "feedback"."type" IN ('Comment') AND "feedback"."article_id" = 6251 AND "feedback"."published" = 't' ORDER BY created_at ASC
Rendered articles/_full_article_content.html.erb (1.1ms)
Rendered articles/_article_content.html.erb (2.3ms)
Rendered articles/_protected_article_content.html.erb (3.6ms)
Rendered articles/_article.html.erb (10.5ms)
Rendered articles/_comment_list.html.erb (0.5ms)
Rendered articles/_comment_form.html.erb (2.8ms)
Rendered articles/read.html.erb within layouts/default (66.3ms)
Rendered shared/_page_header.html.erb (5.1ms)
Sidebar Load (0.3ms) SELECT "sidebars".* FROM "sidebars" ORDER BY active_position ASC
Content Load (6.3ms) select count(*) as count, extract(year from published_at) as year,extract(month from published_at) as month from contents where type='Article' and published = 't' and published_at < '2015-01-04 19:46:32.203509' group by year,month order by year desc,month desc limit 24
Rendered vendor/plugins/archives_sidebar/app/views/archives_sidebar/_content.html.erb (6.7ms)
Category Load (13.5ms)
SELECT categories.id, categories.name, categories.permalink, categories.position, COUNT(articles.id) AS article_counter
FROM categories categories
LEFT OUTER JOIN categorizations articles_categories
ON articles_categories.category_id = categories.id
LEFT OUTER JOIN contents articles
ON (articles_categories.article_id = articles.id AND articles.published = 't')
GROUP BY categories.id, categories.name, categories.position, categories.permalink
ORDER BY position
Rendered vendor/plugins/category_sidebar/app/views/category_sidebar/_content.html.erb (24.7ms)
Completed 200 OK in 693.8ms (Views: 175.4ms | ActiveRecord: 67.4ms)
@Flameeyes
Copy link
Author

The last part with "Category Load" is because I'm using the category sidebar. Since my blog categories are fairly stable, I'm just going to write it in the view instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment