Skip to content

Instantly share code, notes, and snippets.

@benjohnson77
Last active December 26, 2015 06:29
Show Gist options
  • Select an option

  • Save benjohnson77/7108171 to your computer and use it in GitHub Desktop.

Select an option

Save benjohnson77/7108171 to your computer and use it in GitHub Desktop.

Revisions

  1. benjohnson77 revised this gist Jul 22, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    Started GET "/books" for 96.226.128.2 at 2013-10-22 20:18:56 +0000
    Processing by Web::BooksController#index as HTML
    User Load (2.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 38 LIMIT 1
  2. benjohnson77 created this gist Oct 22, 2013.
    28 changes: 28 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@

    Started GET "/books" for 96.226.128.2 at 2013-10-22 20:18:56 +0000
    Processing by Web::BooksController#index as HTML
    User Load (2.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 38 LIMIT 1
    (2.4ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'have_read'
    (75.2ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'want_to_read'
    (54.7ms) SELECT COUNT(*) FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END)
    Rendered shared/v2/_breadcrumb.haml (2.3ms)
    (2.8ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END) LIMIT 16) subquery_for_count
    ReadingAction Load (19.9ms) SELECT reading_actions.*, readings.id as reading_id, readings.read_buckets as reading_read_buckets,
    readings.is_private as reading_is_private, readings.reading_type as reading_reading_type, readings.last_opened_at as reading_last_opened_at,
    readings.created_at as reading_created_at, readings.updated_at as reading_updated_at FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END) ORDER BY readings.last_opened_at desc LIMIT 16
    Book Load (478.0ms) SELECT `books`.* FROM `books` WHERE `books`.`id` IN (35924, 1262, 31357, 35546, 31640, 188727, 36927, 188726, 44140, 76018, 12007, 70552, 87701, 46407, 62165, 12517)
    (2.8ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'have_read') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END) LIMIT 12) subquery_for_count
    -------------------------------------------
    Started GET "/books" for 96.226.128.2 at 2013-10-22 20:40:06 +0000
    Processing by Web::BooksController#index as HTML
    User Load (2.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 38 LIMIT 1
    (2.4ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'have_read'
    (2.2ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'want_to_read'
    (3.5ms) SELECT COUNT(*) FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END)
    Rendered shared/v2/_breadcrumb.haml (1.9ms)
    (2.7ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END) LIMIT 16) subquery_for_count

    ------------------------------------------------