Automatic EXPLAIN on slow-running SQL queries. This feature has been removed from Rails 4.
config.active_record.auto_explain_threshold_in_seconds = 0.5
We find it useful, in controlled circumstances. I came up short in searching for answers to the following questions.
What was the underlying rationale for removing auto-EXPLAIN?
(I'm sure the reasons are sound, but I can't find what they are.)
Is there a way to reintroduce auto-EXPLAIN in my Rails 4 codebase?
(Couldn't find a gem, nor any online information)
Here is the commit that removed auto_explain
. Looks like the reasoning is that it was rarely used and slightly problematic w/ the asset pipeline. As the commit notes you can still use ActiveRecord::Relation#explain
to generate explain queries, but if you want to have it automatically called you will have to implement that yourself. Looking over the removed code in this commit should help you get on the right path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With