This gem adds an analyze
method to Active Record query objects. It executes EXPLAIN ANALYZE
on a query SQL.
In your Gemfile:
gem 'activerecord-analyze'
It is a bit experimental and can break with new Rails release. As soon as this pull request is merged it will be obsolete.