Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | moves some auto explain logic to the subscriber [José Valim & Xavier Noria] | Xavier Noria | 2011-12-04 | 1 | -17/+0 |
| | |||||
* | implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria] | Xavier Noria | 2011-12-04 | 1 | -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_explain | Xavier Noria | 2011-12-03 | 1 | -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.call | Xavier Noria | 2011-12-02 | 1 | -3/+3 |
| | |||||
* | two small details from the previous patch | Xavier Noria | 2011-12-02 | 1 | -1/+1 |
| | |||||
* | implements AR::Base(.|#)silence_auto_explain | Xavier Noria | 2011-12-02 | 1 | -60/+90 |
| | |||||
* | revises some details in the previous explain patch | Xavier Noria | 2011-12-02 | 1 | -2/+2 |
| | |||||
* | implements automatic EXPLAIN logging for slow queries | Xavier Noria | 2011-12-02 | 1 | -0/+76 |