The pg_query_analyzer gem: PostgreSQL query analysis in your development logs

I just wrapped up a small gem called pg_query_analyzer that’s based on some old code that can be found on the interwebs in various states of disrepair. This latest incarnation is a simple gem that provides a PostgreSQL query analysis in the development log of a Rails app.

This is useful for finding indexes that your database may benefit from. There are alternatives available (e.g. rails_indexes) that evaluate your application and guess at which indexes might help you, and provide example migrations to add them. That kind of thing is definitely cool, but I’ve found that performing a manual analysis using tools like this gem I’m releasing will typically lead to the best results. Perhaps you would consider using both techniques? It’s smart, at least, to verify that the database indexes you add to your application are having the intended effect of speeding things up!

I hope you’ll find the README I’ve provided with this gem to be helpful in your quest for a fast and scalable application using PostgreSQL.

Good luck, and good indexing😉

Published by

Trevor Turk

A chess-playing machine of the late 18th century, promoted as an automaton but later proved a hoax.