Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wtnabe/activerecord-simple_explain
explain method for ActiveRecord 3.0.x and 3.1.x
https://github.com/wtnabe/activerecord-simple_explain
activerecord ruby rubygems
Last synced: 13 days ago
JSON representation
explain method for ActiveRecord 3.0.x and 3.1.x
- Host: GitHub
- URL: https://github.com/wtnabe/activerecord-simple_explain
- Owner: wtnabe
- License: mit
- Created: 2013-09-21T13:36:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-22T07:10:07.000Z (over 11 years ago)
- Last Synced: 2024-12-15T17:23:20.725Z (about 1 month ago)
- Topics: activerecord, ruby, rubygems
- Language: Ruby
- Size: 117 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ActiveRecord::SimpleExplain
## Implemented
`ActiveRecord::Relation.explain()` method for ActiveRecord 3.0.x and 3.1.x and 3.2.x with SQLite
## Not Implemented
auto explain
## Supported Versions
* Ruby 1.8.7+
* ActiveRecord 3.0.x - 3.2.x## Supported Adapters
* SQLite
* MySQL
* PostgreSQL## Depending
* [cldwalker/hirb](https://github.com/cldwalker/hirb)
* [miaout17/hirb-unicode](https://github.com/miaout17/hirb-unicode)## Installation
Add this line to your application's Gemfile:
gem 'activerecord-simple_explain'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activerecord-simple_explain
## Usage
just call ActiveRecord::Relation.explain()
ex)
Blog.joins(:comments).explain
on Rails console ( Rails 3.2 + SQLite Adapter )
development(main):001:0> Blog.joins(:comments).explain
(0.1ms) explain query plan SELECT "blogs".* FROM "blogs" INNER JOIN "comments" ON "comments"."blog_id" = "blogs"."id"
+------------------------------------------------------------------+------+-------+----------+
| detail | from | order | selectid |
+------------------------------------------------------------------+------+-------+----------+
| SCAN TABLE comments (~1000000 rows) | 1 | 0 | 0 |
| SEARCH TABLE blogs USING INTEGER PRIMARY KEY (rowid=?) (~1 rows) | 0 | 1 | 0 |
+------------------------------------------------------------------+------+-------+----------+
2 rows in set
=> nil## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request