Query Stats

Query Stats is a Rails plugin to help track database queries. Rather than watching the logs with tail to judge performance, display the query count directly on your page footer.

Example:
1 class ApplicationController < ActionController::Base
2   include QueryStats
3 end
Towards the end of your application layout display statistics, such as:
1 <% if RAILS_ENV == "development" %>
2 Queries in Controller: <%= queries.count_with_label :controller %><br />
3     Queries in View: <%= queries.count_with_label :view %><br />
4     Query Runtime: <%= queries.total_time =><br />
5  <% end %>

Tags

Currently tagged with: activerecord, logging, statistics
You need to Login to tag this item.