Skip to content

PgDog vs PgBouncer: pooling, load balancing and sharding

by Versuscraft team · published 21 November 2026

PgDog vs PgBouncer: pooling, load balancing and sharding - the post as a proof sheet: both sides, the checked figures and the date they were verified

Last verified: 21 November 2026

PgDog is a Postgres proxy that does connection pooling, load balancing and sharding from one Rust executable. (PgDog docs, PgDog docs) PgBouncer is a lightweight connection pooler built to cut the cost of opening new Postgres connections. (PgBouncer docs, PgBouncer docs)

Pick PgDog if you need transaction pooling that keeps SET and LISTEN working, built-in read routing, or a path to sharding. (PgDog docs, PgDog docs) Pick PgBouncer if pooling is the only job, you want a single-threaded process with a footprint of 2 kB per connection by default, and failover is handled elsewhere. (PgBouncer docs, PgBouncer docs)

Key takeaways

  • In transaction pooling, PgBouncer's feature map marks SET/RESET and LISTEN as "Never" and it learns about SET changes only for parameters Postgres reports, while PgDog keeps SET statements, LISTEN/NOTIFY and advisory locks working. (PgBouncer docs, PgBouncer docs)
  • PgDog splits reads from writes and can follow a promoted primary; PgBouncer has no internal failover detection. (PgDog docs, PgDog docs)
  • PgBouncer is single-threaded and uses one CPU core per instance; PgDog is multithreaded and shares one pool inside a single process. (PgBouncer docs, PgDog docs)
  • PgDog is open source under the AGPL v3, with a closed-source Enterprise edition priced on request, while PgBouncer ships under the ISC License. (PgDog docs, PgDog docs)

At a glance

PgDogPgBouncer
What it isPooler, load balancer, sharderLightweight connection pooler
Default pooling modeTransactionSession
SET in transaction poolingParsed and handledReported parameters only
ThreadingMultithreaded, asyncone CPU core per instance
Read/write splitBuilt inNot published
Failover detectionFollows a promoted replicaNot built in
ShardingBuilt inNot published
LicenceAGPL v3ISC License
Paid tierEnterprise, price on requestNot published

Connection pooling: what survives transaction mode

This is where the two differ most for an existing app. PgBouncer defaults to session pooling and also offers transaction and statement pooling. (PgBouncer docs, PgBouncer docs)

In transaction pooling, PgBouncer's feature map marks SET/RESET, LISTEN and session-level advisory locks as "Never". (PgBouncer docs) Its config docs add one exception: PgBouncer tracks the parameters Postgres reports to the client, and it only learns about SET changes to those. (PgBouncer docs) Protocol-level prepared statements can be tracked in that mode since version 1.21.0, once max_prepared_statements is set to a non-zero value. (PgBouncer docs)

PgDog's README puts it directly: like PgBouncer it does transaction and session pooling, but unlike PgBouncer it handles SET statements and startup options. (PgDog docs) LISTEN/NOTIFY works because PgDog runs its own pub/sub queue for connected clients. (PgDog docs) There is a catch: when a client takes an advisory lock, PgDog pins that server connection to the client. (PgDog docs)

Load balancing and failover

PgDog sends SELECT queries to replicas and everything else to the primary, with 3 strategies for spreading reads. (PgDog docs, PgDog docs) A replica that fails a health check leaves the rotation, by default for 5 minutes. (PgDog docs) When a replica is promoted, PgDog can redirect writes to it, though it does not replace a tool like Patroni that runs the failover itself. (PgDog docs)

PgBouncer keeps this outside the pooler. (PgBouncer docs) To spread connections across servers, its FAQ suggests DNS round-robin or a TCP load balancer such as HAProxy. (PgBouncer docs)

A host list in the config is used round-robin, but PgBouncer has no way to skip unreachable hosts in it. (PgBouncer docs) PgBouncer has no internal failover detection; it reconnects when the IP behind a DNS name changes or after a config reload. (PgBouncer docs)

Sharding and scaling writes

Sharding is PgDog's biggest addition. PgDog reads the sharding key from each query and routes it to the right shard, while queries without a key run on all shards in parallel. (PgDog docs)

Cross-shard transactions can use Postgres two-phase commit so writes land atomically. (PgDog docs) PgDog can also reshard in the background over logical replication, without downtime. (PgDog docs)

Plan around the gaps. Cross-shard SQL support is limited, and some sharding features are still experimental. (PgDog docs, PgDog docs) PgDog can change a row's sharding key online, but only one row at a time; an UPDATE that touches several rows aborts the transaction. (PgDog docs)

Performance and threading

PgBouncer is single-threaded, using one CPU core per instance. (PgBouncer docs) To use more cores, you can run multiple PgBouncer instances on the same host and port with so_reuseport. (PgBouncer docs) The upside is a small footprint of 2 kB per connection by default. (PgBouncer docs)

PgDog is multithreaded on the Tokio async runtime. (PgDog docs) On its homepage, PgDog claims 50,000+ transactions/s per thread and says a few Postgres connections can serve 100,000+ clients. (PgDog docs) Treat these as PgDog's own figures, not an independent benchmark.

Security and authentication

PgBouncer authenticates clients with an MD5 password check by default. (PgBouncer docs) It also supports LDAP and PAM, plus TLS client certificates. (PgBouncer docs)

PgDog lists five authentication methods, including AWS RDS IAM tokens for its own connection to Postgres. (PgDog docs) Both sides of a PgDog connection can use TLS. (PgDog docs)

Operations and upgrades

PgBouncer is managed through an admin console of SHOW commands. (PgBouncer docs) Its docs describe a zero-downtime rolling restart of two PgBouncer processes using SHUTDOWN WAIT_FOR_CLIENTS. (PgBouncer docs, PgBouncer docs) The PgBouncer 1.26.0 release removed the deprecated online restart (-R). (PgBouncer docs)

PgDog offers a PgBouncer-style admin database, an OpenMetrics endpoint and OTEL export. (PgDog docs) New PgDog releases ship every week, on Thursday. (PgDog docs) Its Linux binaries need glibc 2.39 or later. (PgDog docs)

Licence, pricing and support

PgDog is free under the AGPL v3, and an enterprise licence exists for companies that don't allow AGPL. (PgDog docs) PgDog Enterprise is closed source and adds a control plane for managing multiple PgDog nodes, with SLA-backed support that promises a response within 15 minutes. (PgDog docs, PgDog docs) For PgDog Enterprise pricing, the docs say to contact PgDog. (PgDog docs)

PgBouncer is distributed under the ISC License. (PgBouncer docs) Its community page points to its GitHub issue tracker and Stack Overflow for support. (PgBouncer docs)

Migration impact

PgDog reads 2 configuration files: pgdog.toml for hosts and sharding, and users.toml for usernames and passwords. (PgDog docs) Plan to rewrite your PgBouncer settings into those two files. Dashboards built on PgBouncer's SHOW commands need checking, because PgDog's admin database isn't 100% compatible. (PgDog docs)

Where PgDog wins

  • SET, LISTEN/NOTIFY and advisory locks keep working in transaction mode. (PgDog docs)
  • Read routing and failover detection live in the same executable as the pooler. (PgDog docs, PgDog docs)
  • Sharding comes with two-phase commit and online resharding. (PgDog docs, PgDog docs)

Where PgBouncer wins

Limitations to plan for

  • PgDog pins a server connection while a client holds an advisory lock. (PgDog docs)
  • That lock detection needs PgDog's query parser, which is on when the deployment is sharded or uses read/write split. (PgDog docs)
  • PgDog's cross-shard SQL is limited. (PgDog docs)
  • PgBouncer uses one CPU core per instance, so scaling up means running several processes. (PgBouncer docs)
  • PgBouncer has no internal failover detection. (PgBouncer docs)

If you only need a pooler and want your OS distribution's own package, PgBouncer is the simpler choice.

Which one fits your use case

  • For an app that sets session variables such as statement_timeout per request, PgDog fits because SET survives its transaction mode.
  • A team that already runs HAProxy and Patroni and only wants pooling will find PgBouncer enough.
  • When one Postgres primary is running out of write capacity, PgDog offers a sharding path in the same proxy.
  • If you deploy on Windows or want your distribution's own package, PgBouncer is the simpler install.

Verdict

Pick PgDog if you want one proxy for pooling, read routing and failover detection, and you need session features now or sharding later. Pick PgBouncer if you want a single-purpose pooler with a small footprint and documented rolling restarts, and you handle routing elsewhere.

Frequently asked questions

Is PgDog a drop-in replacement for PgBouncer?

PgDog supports transaction and session pooling and exposes a PgBouncer-style admin database. (PgDog docs) That admin database isn't fully compatible, and configuration moves to pgdog.toml and users.toml. (PgDog docs)

Does PgBouncer support LISTEN/NOTIFY in transaction pooling?

PgBouncer's feature map marks LISTEN as "Never" in transaction pooling. (PgBouncer docs) PgDog supports LISTEN/NOTIFY in transaction mode through its own pub/sub queue. (PgDog docs)

Try PgDog

Run docker run ghcr.io/pgdogdev/pgdog:latest, point a staging app at it, and check that your SET and LISTEN usage works in transaction mode (PgDog). (PgDog docs, PgDog docs)

Sources