Running ActiveRecord Commands in Rails Console without SQL Caching

I would like to know if there is a way to temporarily disable SQL caching in the Rails console.

I run ActiveRecord commands in the Rails console to see how long each request takes. But I can't get the correct measure because Rails is caching SQL and my queries seem to be happening almost instantly.

Any suggestions?

+3


source to share


1 answer


I'm not sure if you can remove it from the console, but I think you can add this to the initializer to remove it for development.



if Rails.env.development?
  Rails.configuration.middleware.delete ActiveRecord::QueryCache
end

      

+2


source







All Articles