Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yhirano55/activerecord-explainer
This gem automatically logs SQL EXPLAIN of every queries
https://github.com/yhirano55/activerecord-explainer
activerecord ruby-on-rails rubygems sql
Last synced: 5 days ago
JSON representation
This gem automatically logs SQL EXPLAIN of every queries
- Host: GitHub
- URL: https://github.com/yhirano55/activerecord-explainer
- Owner: yhirano55
- License: mit
- Created: 2019-05-03T22:26:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-27T12:18:20.000Z (almost 4 years ago)
- Last Synced: 2025-01-02T09:22:01.899Z (6 days ago)
- Topics: activerecord, ruby-on-rails, rubygems, sql
- Language: Ruby
- Homepage:
- Size: 342 KB
- Stars: 49
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ActiveRecord::Explainer
This gem automatically logs `SQL EXPLAIN` of every queries.
You can check naturally every `SQL EXPLAIN` from development log, without :hand: executions.
## Usage
If you use Rails, it's no configuration, and you can logs SQL EXPLAIN of every queries.
![](https://github.com/yhirano55/activerecord-explainer/blob/master/images/v0.2.0.png?raw=true)
## Installation
Add this line to your application's Gemfile:
```ruby
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](https://guides.rubyonrails.org/active_support_instrumentation.html).
- Subscriber handles payload, and execute EXPLAIN from `ActiveRecord::Base`.Please check the [implementation](https://github.com/yhirano55/activerecord-explainer/blob/master/lib/activerecord/explainer/subscriber.rb), if you interested in.
## License
[MIT License](https://opensource.org/licenses/MIT)