aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/explain_subscriber.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use match? where we don't need MatchDataAkira Matsuda2019-07-271-1/+1
| | | | We're already running Performance/RegexpMatch cop, but it seems like the cop is not always =~ justice
* [Active Record] require => require_relativeAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts 9d4f79d3d394edb74fa2192e5d9ad7b09ce50c6d
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* [Active Record] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* Preserve cached queries name in AS notificationsJean Boussier2016-09-221-2/+5
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* typoScott Nelson2015-10-201-1/+1
|
* Let WITH (CTE) queries be explainableVladimir Kochnev2015-05-281-1/+1
|
* Don't try to EXPLAIN select_db callsDaniel Schierbeck2013-05-101-1/+1
|
* let EXPLAIN use a thread locals registry [John J. Wang & Xavier Noria]Xavier Noria2013-04-161-2/+3
| | | | Closes #10198.
* Don't explain except normal CRUD sql.kennyj2012-09-171-1/+2
|
* explain listener does not care about time, so use evented listenerAaron Patterson2012-06-201-2/+5
|
* let automatic EXPLAIN ignore CACHE notificationsXavier Noria2012-02-031-1/+4
|
* moves some auto explain logic to the subscriber [José Valim & Xavier Noria]Xavier Noria2011-12-041-2/+12
|
* simplifies ActiveRecord::ExplainSubscriber [José Valim & Xavier Noria]Xavier Noria2011-12-041-8/+6
|
* implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria]Xavier Noria2011-12-041-0/+13
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.