Sha256: 6e6dd595b264ae73a3113f7778427bfe0b4e37a39014c682e2b5849d78aef155

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

= Query Diet

Query Diet counts the number of database queries for the last request and *subtly* displays it in the upper right corner of your screen.
The display turns red if too many queries are run, or if they take too long.
This is useful to prevent {N + 1 queries}[http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations] from creeping into your code.

This is Query Diet being happy about 3 requests taking 66ms:

http://gem-session.com/files/query_diet_happy.png

This is Query Diet being angry about 103 requests taking 164ms:

http://gem-session.com/files/query_diet_angry.png

== Installation

Install the gem with
    sudo gem install query_diet

There is no further setup necessary after you add the <tt>query_diet</tt> dependency to your Rails application.

We recommend you only use the gem with the development environment.

== Changing warning thresholds

You can define when the counter turns into a red warning. The default threshold is 8 queries and 5000 miliseconds.
To change the default, add the following to <tt>config/initializers/query_diet.rb</tt>:

    if defined?(QueryDiet)
      QueryDiet::Logger.bad_count = 8
      QueryDiet::Logger.bad_time = 5000
    end

== Rails 3 compatibility

We cannot guarantee Rails 3 compatibility at this point, but we will upgrade the gem when Rails 3 is released.

=== Credits

Henning Koch

{makandra.com}[http://makandra.com/]

{gem-session.com}[http://gem-session.com/]

{Michael Grosser}[https://github.com/grosser]

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
query_diet-0.3.1 README.rdoc
query_diet-0.3.0 README.rdoc