README

Path: vendor/plugins/pgexplain/README
Last Update: Tue Dec 04 11:53:17 +0100 2007

Pg_explain

Authors:Ramon Salvadó <rsalvado@gnuine.com>

RubyForge_Project_Page

Any questions/comments can be addressed to Ramon Salvadó <rsalvado@gnuine.com>

This Rails plugin shows the output, in your application logs, of applying "Explain" or "Explain Analyze" to the select queries of your rails application. It should be used with a PostgreSQL database.

Installation

Needs to have the postgres gem installed:

sudo gem install postgres

To install the plugin:

script/plugin install svn://rubyforge.org/var/svn/pgexplain

Features

  • By default works only in development environment and doing just explains.
  • Colors can be turned on off (this is useful if you want to look the logs later from the log file).
  • Instead of doing explains it can be configured to do explain analyze.
  • It can be disabled and enabled (this is useful if you want to turn it off in the console, for example).

Configuration

  • In you environment.rb
 Pg_explain::configure :color => false, :analyze = true
  • To disable the plugin
 Pg_explain::disable
  • To enable the plugin
 Pg_explain::enable

Needed things

  • PostgreSQL database
  • postgres gem: sudo gem install postgres

Acknowledgments:

  • Bob Silva for his Query Analyzer plugin from which I borrowed some code/concepts.

[Validate]