Databases
Intermediate
What is Database Connection Pooling?
A technique that maintains a cache of database connections for reuse, reducing the overhead of creating new connections.
Connection pooling eliminates the expensive process of establishing new database connections for each request. A pool manager maintains a set of open connections that application threads borrow and return. Tools like PgBouncer (PostgreSQL), HikariCP (Java), and built-in pool support in frameworks manage this automatically. Key settings include minimum/maximum pool size, connection timeout, idle timeout, and max lifetime. Proper pooling can handle thousands of application-level connections with just tens of actual database connections.