Dev.to
7/16/2026

Why Your Postgres Is Idle But Your API Is Timing Out (PgBouncer Pool Exhaustion, Explained)
Short summary
API timeouts with idle Postgres are usually PgBouncer connection pool exhaustion, not a database problem. Transactions holding connections during slow external calls or lock waits cause client queues to grow unbounded. Use SHOW POOLS to check cl_waiting vs sv_active, size pools for tail latency not averages, and avoid cranking default_pool_size as a quick fix.
- •Pool exhaustion happens when transactions hold connections longer than expected (slow API calls, lock waits)
- •Diagnose with PgBouncer SHOW POOLS — climbing cl_waiting with pinned sv_active is the signature
- •Size pools using Little's Law but account for tail latency, not just averages
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



