Skip to content

Query cache is enabled for load balancer connections in a console session

During an incident where we were running some commands in a Rails console, we noticed that queries were being cached.

In a55a37fb, we enabled query caching for the replica pools. We enable the query cache just before we checkout a connection for read queries.

This is different from ActiveRecord::Base.connection_pool where the cache is enabled using executor hooks. So it's enabled when a request starts and cleared when it ends.

I think in most cases it would be better for the query cache to be disabled in the console.

cc @igorwwwwwwwwwwwwwwwwwwww @nmilojevic1 @ayufan