Database Connection Pooling: Sizing Formulas, Timeouts, and Leaks
By Sharon Ben-Moshe · October 13, 2026 · 1 min read
Sharon Ben-Moshe is the founder of sqlfmt, a browser-based SQL formatter and validator with misspelled-keyword suggestions across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery.
Master database connection pooling. Learn the HikariCP sizing formula, PgBouncer transaction pooling, timeout settings, and leak detection.
Quick answer
A database connection pool maintains a cache of open, reusable database connections to eliminate the heavy CPU and TCP latency cost of establishing new connections for every HTTP request. Size your pool using the classic HikariCP formula: connections = (core_count * 2) + effective_spindle_count. For high-concurrency PostgreSQL apps, use PgBouncer in transaction pooling mode.