public
Description: A Rails plugin to track database queries.
Homepage: http://code.google.com/p/query-stats/
Clone URL: git://github.com/dan-manges/query_stats.git
dan-manges (author)
Sun Aug 24 16:35:04 -0700 2008
commit  d6156be5457068b9511dfccd9dd16b7f921a5864
tree    2e3baad9592c302a527bc3d66c7e4b86f6e9fbc3
parent  48c4474390e5a5e773768dcf33f4a2ed4b371c80
name age message
file .gitignore Loading commit data...
file CHANGELOG
file README.rdoc
file Rakefile
file init.rb Sat Jul 12 15:36:33 -0700 2008 passing tests with mysql adapter on rails 2.1 [dan-manges]
directory lib/
directory test/
README.rdoc

Query Stats Plugin

The Query Stats plugin tracks database queries.

Usage

Use the "queries" helper or controller method to access data on the queries. See the documentation on QueryStats::Holder for functionality.

You can easily display statistics in your page footer, such as:

  Queries in Controller: <%= queries.count_with_label :controller %>
  Queries in View:       <%= queries.count_with_label :view %>
  Query Time:            <%= queries.runtime %>

Logging

QueryStats adds the number of queries to the log in the DB section:

  Completed in 0.00642 (155 reqs/sec) | Rendering: 0.00228 (35%) | DB: 0.00247 (38%) 6 queries | 200 OK [http://test.host/]

Response Headers

  • X-QueryCount will be set to the number of queries
  • X-QueryRuntime will be set to the db runtime

Requirements

Tests pass with:

  • Rails: 1.2.6, 2.0.2, 2.1.0
  • Adapters: sqlite3, mysql

Maintainer

  • Dan Manges

Contributors

  • Guillaume Dufloux

License

Released under the MIT license.