Sha256: 8f68093093857f1fb94fff92cf2e54379f4dd493397805641f0fa379a4677bc9

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 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/]

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
query_diet-0.2.3 README.rdoc
query_diet-0.2.2 README.rdoc
query_diet-0.2.1 README.rdoc