aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-09-16 11:55:44 -0700
committerPiotr Sarnacki <drogus@gmail.com>2012-09-16 11:55:44 -0700
commit82efe8943bf6ff12b597987506bf177d66609049 (patch)
treedcf5a5ca4516a996bb5b78bd4d79b66ba3aeae9e /activerecord/lib
parentaa81bf74574629ab585de57f5aa18689de723b9d (diff)
parent5bb056d268c9fc8c08c04ef04aef0c499b08a12c (diff)
downloadrails-82efe8943bf6ff12b597987506bf177d66609049.tar.gz
rails-82efe8943bf6ff12b597987506bf177d66609049.tar.bz2
rails-82efe8943bf6ff12b597987506bf177d66609049.zip
Merge pull request #7657 from kennyj/fix_6458-2
Don't explain except normal CRUD sql.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/explain_subscriber.rb3
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 d5ba343b4c..0f927496fb 100644
--- a/activerecord/lib/active_record/explain_subscriber.rb
+++ b/activerecord/lib/active_record/explain_subscriber.rb
@@ -18,8 +18,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)