Opening a database connection is expensive: TCP handshake, authentication, memory allocation. Opening a new connection per request wastes resources.
Connection pooling maintains a pool of open connections. Requests borrow a connection, use it, and return it.
Settings:
- Min connections: Keep this many always open
- Max connections: Never exceed this
- Idle timeout: Close unused connections after this time
Typical values: - connections per application server.
Tools: PgBouncer (PostgreSQL), ProxySQL (MySQL), built-in pools in most frameworks.
Mention connection pooling when discussing high-traffic database access.