diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-16 21:51:38 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-16 22:18:11 -0300 |
commit | 6abe0e7b4e10b8626d1a294eaa5fcaa28ec9f27d (patch) | |
tree | 5c473f97736b03eb4d031d8190d082a545cfcc56 /activerecord/lib/active_record/explain_subscriber.rb | |
parent | dbfdd00e38019f9e52df1f74d49a460d8cc1bba5 (diff) | |
download | rails-6abe0e7b4e10b8626d1a294eaa5fcaa28ec9f27d.tar.gz rails-6abe0e7b4e10b8626d1a294eaa5fcaa28ec9f27d.tar.bz2 rails-6abe0e7b4e10b8626d1a294eaa5fcaa28ec9f27d.zip |
Backport explain fixes.
* Mark as SCHEMA some schema database queries. #7648
* Don't explain queries except normal CRUD sql. #7657
Closes #6458
Closes #7544
Diffstat (limited to 'activerecord/lib/active_record/explain_subscriber.rb')
-rw-r--r-- | activerecord/lib/active_record/explain_subscriber.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/explain_subscriber.rb b/activerecord/lib/active_record/explain_subscriber.rb index 1f8c4fc203..859c8edfc5 100644 --- a/activerecord/lib/active_record/explain_subscriber.rb +++ b/activerecord/lib/active_record/explain_subscriber.rb @@ -15,8 +15,9 @@ module ActiveRecord # On the other hand, we want to monitor the performance of our real database # queries, not the performance of the access to the query cache. IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN CACHE) + EXPLAINED_SQLS = /\A\s*(select|update|delete|insert)/i def ignore_payload?(payload) - payload[:exception] || IGNORED_PAYLOADS.include?(payload[:name]) + payload[:exception] || IGNORED_PAYLOADS.include?(payload[:name]) || payload[:sql] !~ EXPLAINED_SQLS end ActiveSupport::Notifications.subscribe("sql.active_record", new) |