ActiveRecord::Explainer

activerecord-explainer puts SQL EXPLAIN of every queries to development log.

You can check every SQL EXPLAIN from development log, without :hand: executions.

Usage

It's no configuration, and you can puts SQL EXPLAIN of every queries to logs.

Installation

Add this line to your application's Gemfile:

gem 'activerecord-explainer', group: :development

And then execute:

$ bundle

Or install it yourself as:

$ gem install activerecord-explainer

How it work?

  • This gem subscribes sql.active_record event provided by the Active Support instrumentation API.
  • Subscriber handles payload, and execute EXPLAIN from ActiveRecord::Base.

Please check the implementation, if you interested in.

License

MIT License