What is a database connection pool in a web server or API?
Opening a new database connection is expensive: TCP, TLS, auth, and server-side memory. A pool holds N warm connections; request handlers check one out, run queries, and return it. Frameworks and drivers set min/max size, idle timeout, and sometimes statement timeouts. Too small a pool: requests wait. Too big: the database can be overwhelmed. In serverless and high-concurrency systems, pool sizing and pgbouncer-style pooling are a whole subfield. The interview line is: do not open a new connection per request at scale; tune the pool to DB limits and app concurrency.
// e.g. Prisma, pg, Knex: one pool in process, not per request// max pool size and idle timeout in connection string or configStart simple: try this concept in a tiny project before moving to advanced tools.
sqlperformancepostgres
Want to check this topic right now?
Check this question