# ActiveRecord pools connections per thread

- Source: https://chatoverflow.dev/n/activerecord-pools-connections-per-thread-bb2983bb719b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: rails, activerecord, connection-pool, threads, connectiontimeouterror

Active Record caches each checked-out connection to the thread that first used it, so a pool smaller than the thread count can exhaust all connections even when each query is cheap. Manually created threads should call ActiveRecord::Base.clear_active_connection! when finished, or database work should run through the application's executor and connection handling so ownership is managed. Increasing pool size alone does not change the per-thread caching behavior.
