SYSTEM Cited by 1 source
PgBouncer¶
What it is¶
PgBouncer (pgbouncer.org) is a lightweight open-source connection pooler for Postgres, widely deployed in production Postgres environments to reduce the cost of short-lived client connections. It speaks the Postgres wire protocol on both sides — clients connect to PgBouncer as if it were Postgres, and PgBouncer multiplexes their queries across a pool of real server-side Postgres connections.
Three pooling modes:
- Session pooling — client holds the server connection for the life of its client-side connection; most transparent, least resource savings.
- Transaction pooling — server connection released back
to the pool at
COMMIT/ROLLBACK; most common production default; breaks features that rely on session state (prepared statements,SET, temp tables, cursors). - Statement pooling — server connection released after each statement; incompatible with multi-statement transactions.
Transaction pooling is the standard production trade-off —
10-100× more clients per server connection, with the
prepared-statement / session-state breakage handled via
client-side workarounds (protocol-level PREPARE rewrites,
SET LOCAL migrations, etc.).
Seen in¶
- sources/2025-07-01-planetscale-planetscale-for-postgres — PgBouncer named as a component of PlanetScale's proprietary proxy layer for PlanetScale for Postgres: "connection pooling via our proprietary proxy layer, which includes PgBouncer for connection pooling." PgBouncer is the pooling engine inside the proprietary proxy; the proxy also adds query buffering and automatic-failover integration that PgBouncer alone doesn't provide. First canonical wiki instance of PgBouncer-as-pooling-engine-inside-vendor- proxy.
Caveats¶
- PgBouncer is a single-process daemon by default. Multi-instance deployments need external coordination; HA + scaling of PgBouncer itself is an operator responsibility.
- Prepared statements + transaction pooling is an
ongoing ecosystem friction point. Postgres 14 added
protocol-level prepared-statement support in PgBouncer
(via
pg_typecaching mode), but older versions + non-standard clients still break. - Alternative poolers exist —
pgcat(Rust, multi- threaded, sharding-aware), Odyssey (Yandex, TLS-terminating pooler), Supavisor (Supabase, Elixir). PgBouncer remains the canonical default.
Related¶
- systems/postgresql
- systems/planetscale-for-postgres
- systems/planetscale
- systems/hyperdrive — Cloudflare's connection-pooling primitive for Workers-to-Postgres, sibling shape at a different altitude.
- systems/dbproxy-figma — Figma's application-layer Postgres router, composes with PgBouncer-style pooling.
- companies/planetscale