Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ainame/explain_parser
Parser for result of EXPLAIN of MySQL(inspired from http://search.cpan.org/~moznion/MySQL-Explain-Parser-0.02/lib/MySQL/Explain/Parser.pm)
https://github.com/ainame/explain_parser
Last synced: about 2 months ago
JSON representation
Parser for result of EXPLAIN of MySQL(inspired from http://search.cpan.org/~moznion/MySQL-Explain-Parser-0.02/lib/MySQL/Explain/Parser.pm)
- Host: GitHub
- URL: https://github.com/ainame/explain_parser
- Owner: ainame
- License: mit
- Created: 2014-08-08T14:17:53.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T21:19:31.000Z (over 3 years ago)
- Last Synced: 2024-05-01T19:26:56.279Z (8 months ago)
- Language: Ruby
- Size: 10.7 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ExplainParser
Parser for result of EXPLAIN of MySQL(inspired from http://search.cpan.org/~moznion/MySQL-Explain-Parser-0.02/lib/MySQL/Explain/Parser.pm)
## Installation
Add this line to your application's Gemfile:
gem 'explain_parser'
And then execute:
$ bundle
Or install it yourself as:
$ gem install explain_parser
## Usage
```ruby
input <<-EOS
+----+-------------+-------+------+---------------+------+---------+------+------+----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+----------------------------------------------------------+
| 1 | SIMPLE | users | ALL | NULL | NULL | NULL | NULL | 155 | Using where; Using index Using temporary; Using filesort |
+----+-------------+-------+------+---------------+------+---------+------+------+----------------------------------------------------------+
1 row in set (0.00 sec)
EOSexplains = ExplainParser.call(input) # return result as Array
explain = explains.first
explain.id #=> 1
explain.select_type #=> 'SIMPLE'...
explain.rows #=> 155
explain.extra #=> 'Using where; Using index Using temporary; Using filesort'
explain.using_filesort? #=> true
explain.using_where? #=> true
explain.using_temporary? #=> true
explain.using_index? #=> true
```## Contributing
1. Fork it ( https://github.com/[my-github-username]/explain_parser/fork )
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 a new Pull Request