A new way to index your Rails app’s database
Relational databases like MySQL rely on correct indexing of tables in order to function quickly. In fact, adding proper database indexes is often one of the biggest improvements you can make to any application, including Rails applications.
A few well-known blog posts have dealt with this subject, giving excellent advice on how to index your tables for best performance. Jamis dealt with the subject a while ago, and recently Matt Jankowski has posted a fairly exhaustive guide. I felt that this excellent guides could be built upon, and the analysis that I would do, given a query to index, could be automated.
see trhe full version of description here http://www.samsworldofno.com/2009/10/05/introducing-ambitious-query-indexer/ or use the alternative here http://github.com/mikhailov/DbIndexes