Postgres: How Many Connections to Open? Benchmark
TL;DR The optimal number of connections varies per workload and hardware. This benchmark observes how throughput, latency, and wait events change as connection count grows — it does not prescribe a universal number. $\text{core count} \times 2$ is a widely cited starting heuristic from the PostgreSQL wiki. Use it as a starting point, then tune upward until TPS plateaus and latency variance grows. 1. Problem Statement How many Postgres connections should I open? Should I open as many as possible? ...