The database connection pool is exhausted. What do I do?
Practice this questionShort explanation:
A connection pool has a limited number of database connections and queues callers when all are busy. Exhaustion can come from too much parallel work, slow queries, long transactions or connections that are never released. Increasing the limit may overload the database instead of fixing the cause.
Key points:
-
Check active queries, pool wait time, leaks and long transactions.
-
Release acquired connections in cleanup paths; reduce query duration and concurrency.
-
Budget connections across all app instances before increasing pool size.
-
Check checkout duration and pool wait time separately from SQL execution time.
-
Use cleanup paths such as finally for manually acquired connections and avoid creating a new pool per request.
Interview point:
- Budget the total across every instance, worker and deployment overlap, not just one process's pool size.