Deploy PgBouncer as a connection pooler in front of Postgres to reduce connection overhead

domain: pgbouncer.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install PgBouncer on a host that can reach your Postgres server: `apt install pgbouncer` or pull the Docker image `bitnami/pgbouncer`.
  2. Configure `pgbouncer.ini`: set `[databases]` with your target DB alias and DSN, `pool_mode = transaction`, `max_client_conn = 1000`, and `default_pool_size = 20`.
  3. Configure `userlist.txt` with Postgres usernames and their md5-hashed passwords (format: `"username" "md5<hash>"`); point `auth_file` in `pgbouncer.ini` to this file.
  4. Start PgBouncer and connect your application to the PgBouncer listen port (default 6432) instead of the Postgres port (5432).
  5. Monitor pool saturation with `psql -h 127.0.0.1 -p 6432 -U pgbouncer pgbouncer -c 'SHOW POOLS;'` — watch `cl_waiting` for queued clients.

Known gotchas

Related routes

Configure PgBouncer transaction pooling with a Python psycopg application
pgbouncer.org · 5 steps · unrated
Configure PgBouncer transaction-mode pooling and avoid prepared-statement pitfalls
pgbouncer · 6 steps · unrated
Perform a zero-downtime PgBouncer restart or config reload using an so_reuseport rolling restart
pgbouncer.org · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans