aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/explain_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Extract `bind_param` and `bind_attribute` into `ActiveRecord::TestCase`Ryuta Kamizono2017-05-041-5/+1
| | | | These are used in tests from anywhere.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* modernizes hash syntax in activerecordXavier Noria2016-08-061-3/+3
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-9/+9
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix explain logging with bindsRyuta Kamizono2016-07-201-4/+4
| | | | `binds` is an array of a query attribute since Active Record 5.0.
* Removed mocha from Active Record Part 2Ronak Jangir2015-09-161-18/+29
|
* Remove Relation#bind_paramsSean Griffin2015-01-271-1/+1
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* some databases do not have bind params (mysql2) so take that in to accountAaron Patterson2014-01-141-2/+6
|
* fix tests for explain plan + bindsAaron Patterson2014-01-131-2/+2
|
* Remove unused return value, because collecting_queries_for_explain isn't ↵kennyj2013-03-061-2/+1
| | | | public API.
* remove AR auto-explain (config.auto_explain_threshold_in_seconds)Yves Senn2013-02-241-68/+4
| | | | | | | | | | We discussed that the auto explain feature is rarely used. This PR removes only the automatic explain. You can still display the explain output for any given relation using `ActiveRecord::Relation#explain`. As a side-effect this should also fix the connection problem during asset compilation (#9385). The auto explain initializer in the `ActiveRecord::Railtie` forced a connection.
* need to to_a the Relation to execute SQL hereAkira Matsuda2013-01-041-1/+1
|
* Don't run explain on slow queries for database adapters that don't support itBlake Smith2012-11-261-0/+10
|
* Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-1/+1
| | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-4/+4
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* Log query plan when we use count_by_sql method.kennyj2012-07-181-0/+10
|
* Fix build. It seems that the Mocha's behavior were changed.kennyj2012-04-251-1/+3
|
* disable automatic explain if there is no logger [closes #4671]Xavier Noria2012-01-261-1/+15
|
* implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria]Xavier Noria2011-12-041-29/+31
| | | | | | | | | | | | | | | | | | | | | | | | | 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-5/+2
| | | | | | | 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.
* implements AR::Base(.|#)silence_auto_explainXavier Noria2011-12-021-0/+11
|
* implements automatic EXPLAIN logging for slow queriesXavier Noria2011-12-021-0/+91