Why does Postgres get slow when your connection pool is too big?

Ada Okafor··1 min read

Distributed systems engineer. I write about Go, Postgres and the failure modes nobody blogs about.

Everyone adds connections when a database gets slow. That usually makes it worse.

Why does a big pool hurt throughput?

Because Postgres is process-per-connection: every idle backend costs memory and every active one competes for the same locks and CPU.

What is the actual fix?

Size the pool to (cores * 2) + spindles, put pgbouncer in front in transaction mode, and measure pg_stat_activity under load — not under hope.

Discussion

No replies yet.