We build Web & Mobile Applications.

< All Articles

Another plugin for the toolbox

Following on from Rob’s Rails plugin round-up a few months back then another plugin has repeatedly found it’s way into our projects - sql_logging.

Installation of the plugin is quick and simple, as usual:

script/plugin install http://svn.lightyearsoftware.com/svn/plugins/sql_logging

You’re then ready to harness the power! Whilst in development mode, the plugin will add additional details to your logfile and allow you to see what’s going on with your queries and where any holdups are occuring.

Rather than re-invent the wheel, I’ll suggest reading the original blog post by the author of the plugin for more details.

I also periodically scan through my logs for long queries using a simple cat and grep combo to give me the 20 slowest queries:

cat log/production.log | grep "Completed in" | cut -f3 -d' ' | sort -n -r | head -n 20

Based on this I can then look through my log and identify the slow query and make efforts to improve it.

Updated on 07 February 2019
First published by Chris Anderton on 21 May 2008
© Chris Anderton 2019
"Another plugin for the toolbox" by Chris Anderton at TheWebFellas is licensed under a Creative Commons Attribution 4.0 International License.