pgexplain
- Authors
-
Ramon Salvadó <[email protected]>
-
Github Project [github.com/marcus-wyatt/pgexplain]
Any questions/comments can be addressed to Ramon Salvadó <[email protected]>
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.
Dependencies
Needs to have the pg gem installed:
sudo gem install pg
Installation
To install as a gem:
sudo gem install pgexplain
To install the plugin:
Github: script/plugin install svn://rubyforge.org/var/svn/pgexplain
Original: 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.
-
Marcus Wyatt for packaging the into a gem.