aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/explain.rb
Commit message (Collapse)AuthorAgeFilesLines
* load active_support/core_ext/class/attribute in active_support/railsXavier Noria2012-08-021-1/+0
|
* Simplify AR configuration code.Jon Leighton2012-06-151-5/+6
| | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* minor comment revisionXavier Noria2012-06-011-1/+1
|
* improve readability of AR explain resultAkira Matsuda2012-06-011-1/+7
|
* More using <tt>x</tt> instead of +x+ when the latter renders improperly.Mark Rushakoff2012-04-271-1/+1
|
* disable automatic explain if there is no logger [closes #4671]Xavier Noria2012-01-261-0/+2
|
* Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-3/+5
| | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* auto_explain_threshold_in_seconds should be a global config option so it can ↵Jon Leighton2011-12-241-8/+3
| | | | be shared between AR::Base and AR::Model
* AS::Concern is not really needed for AR::ExplainXavier Noria2011-12-161-71/+69
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-61/+74
|
* moves some auto explain logic to the subscriber [José Valim & Xavier Noria]Xavier Noria2011-12-041-17/+0
|
* implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria]Xavier Noria2011-12-041-47/+40
| | | | | | | | | | | | | | | | | | | | | | | | | This commit vastly reduces the impact of auto explain logging when enabled, while keeping a negligible cost when disabled. The first implementation was based on the idea of subscribing to "sql.active_record" when needed, and unsubscribing once done. This is the idea behind AR::Relation#explain. Subscribe, collect, unsubscribe. But with the current implementation of notifications unsubscribing is costly, because it wipes an internal cache and that puts a penalty on the next event. So we are switching to an approach where a long-running subscriber is listening. Instead of collecting the queries with a closure in a dedicated subscriber, now we setup a thread local. If the feature is disabled by setting the threshold to nil, the subscriber will call a method that does nothing. That's totally cheap.
* removes the convenience instance version of AR::Base.silence_auto_explainXavier Noria2011-12-031-88/+78
| | | | | | | Rationale: As discussed with José and Jon, this convenience shortcut is not clearly justified and it could let the user thing the disabled EXPLAINs are related to the model instance rather than being globally disabled.
* yield > block.callXavier Noria2011-12-021-3/+3
|
* two small details from the previous patchXavier Noria2011-12-021-1/+1
|
* implements AR::Base(.|#)silence_auto_explainXavier Noria2011-12-021-60/+90
|
* revises some details in the previous explain patchXavier Noria2011-12-021-2/+2
|
* implements automatic EXPLAIN logging for slow queriesXavier Noria2011-12-021-0/+76