🗄️ Database Design / Normalization
Intermediate
What is connection pooling in databases?
Answer
Connection pooling maintains a pool of pre-established database connections that are reused rather than opened and closed for each request. Opening a new database connection is expensive (TCP handshake, authentication, session setup — 20–200ms). A connection pool reduces this overhead dramatically. A pooler (PgBouncer for PostgreSQL, HikariCP for Java) manages the pool: when a request needs a connection, it borrows one from the pool; when done, it returns it. Key parameters: min_connections, max_connections, connection_timeout. Sizing the pool: too small causes queueing; too many exhausts the RDBMS's connection limit and increases memory pressure.
More Database Design / Normalization Questions
View all →- Intermediate What are database anomalies and how does normalization prevent them?
- Intermediate What is denormalization and when is it used?
- Intermediate What are isolation levels in database transactions?
- Intermediate What are dirty reads, non-repeatable reads, and phantom reads?
- Intermediate What is query optimization and what is a query execution plan?