What Is Database Connection Pooling?
Connection pooling maintains a reusable set of open database connections that application code borrows and returns, instead of opening a brand-new connection...
Published November 20, 2026
Connection pooling keeps a set of open database connections ready for reuse instead of opening a new one for every request. It cuts latency and protects the database from too many connections.
The concept
Opening a connection involves TCP and authentication and takes milliseconds; databases also cap concurrent connections.
A pool hands out an idle connection, takes it back after use and limits the maximum so the database is not overwhelmed.
Borrow and return
Practical examples
Node (mysql2)
const pool = mysql.createPool({ host, user, password, database, connectionLimit: 10 })
const [rows] = await pool.query('SELECT 1')PostgreSQL pg
const pool = new Pool({ max: 10, idleTimeoutMillis: 30000 })
const { rows } = await pool.query('SELECT now()')External pooler
PgBouncer or ProxySQL in front of the database for many app instancesCommon mistakes
- Pools larger than the database allows across all app instances.
- Forgetting to release connections (leaks).
- Holding connections during slow external calls.
Key takeaways
- Reuse connections.
- Size pools carefully.
- Always release.
FAQ
How big should a pool be?
Small: often 5–20 per instance; measure.
PHP and pooling?
PHP-FPM mostly uses per-request connections; poolers like PgBouncer help.