Identifying missing indexes in your Rails App – Improvements to Ambitious Query Indexer
Sam Phillips, March 14th, 2010 2:42 pm
Last night, I took the opportunity of a free evening to add a few new features to Ambitious Query Indexer. My inspiration was a spot of welcome coverage from a few blogs, and also the changes that have been made to Elad Meidar’s RailsIndexes plugin. That project interests me a great deal because it is aimed at the same problem, but our implementations are quite different. There’s nothing wrong with a little friendly competition, and AQI was lacking a few features (especially around adding indexes for rails associations) that RailsIndexes had.
Ambitious Query Indexer can now:
- Identify associations between ActiveRecord models, execute the queries used and show what indexes are required.
- Automatically generate the ActiveRecord::Migration syntax, so it’s now really easy to translate the plugin’s output into an actual improvement in the application’s performance.
- Move accurately parse the Ruby code, including no longer getting foxed by commented-out lines.
- Identify optimisation candidates within the Model layer itself.
Of course, I also took the opportunity to tidy up some of the code and leave it in a better state than when I opened it up. As ever, I’m gagging for feedback – especially as this plugin is quite difficult to test. It’s working on every Rails app I can get my hands on at the moment – let me know if you have any issues and I’ll do my best to address them.








