# PgDog vs PgBouncer: pooling, load balancing and sharding

> PgDog is a Postgres proxy that does connection pooling, load balancing and sharding from one Rust executable. PgBouncer is a lightweight connection pooler…

Canonical: https://versuscraft.xyz/p/pgdog-vs-pgbouncer
Published: 2026-11-21
Last verified: 2026-11-21

_Last verified: 21 November 2026_

PgDog is a Postgres proxy that does connection pooling, load balancing and sharding from one Rust executable. ([PgDog docs](https://docs.pgdog.dev/), [PgDog docs](https://pgdog.dev/))
PgBouncer is a lightweight connection pooler built to cut the cost of opening new Postgres connections. ([PgBouncer docs](https://www.pgbouncer.org), [PgBouncer docs](https://www.pgbouncer.org/usage.html))

Pick PgDog if you need transaction pooling that keeps SET and LISTEN working, built-in read routing, or a path to sharding. ([PgDog docs](https://docs.pgdog.dev/), [PgDog docs](https://pgdog.dev/))
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](https://www.pgbouncer.org/features.html), [PgBouncer docs](https://www.pgbouncer.org/config.html))

## 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](https://www.pgbouncer.org/features.html), [PgBouncer docs](https://www.pgbouncer.org/config.html))
- PgDog splits reads from writes and can follow a promoted primary; PgBouncer has no internal failover detection. ([PgDog docs](https://pgdog.dev/), [PgDog docs](https://github.com/pgdogdev/pgdog))
- PgBouncer is single-threaded and uses one CPU core per instance; PgDog is multithreaded and shares one pool inside a single process. ([PgBouncer docs](https://www.pgbouncer.org/config.html), [PgDog docs](https://docs.pgdog.dev/features/connection-pooler/))
- 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](https://github.com/pgdogdev/pgdog), [PgDog docs](https://docs.pgdog.dev/enterprise_edition/))

## At a glance

| | PgDog | PgBouncer |
| --- | --- | --- |
| What it is | Pooler, load balancer, sharder | Lightweight connection pooler |
| Default pooling mode | Transaction | Session |
| SET in transaction pooling | Parsed and handled | Reported parameters only |
| Threading | Multithreaded, async | one CPU core per instance |
| Read/write split | Built in | Not published |
| Failover detection | Follows a promoted replica | Not built in |
| Sharding | Built in | Not published |
| Licence | AGPL v3 | ISC License |
| Paid tier | Enterprise, price on request | Not 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](https://www.pgbouncer.org/usage.html), [PgBouncer docs](https://www.pgbouncer.org/features.html))

In transaction pooling, PgBouncer's feature map marks SET/RESET, LISTEN and session-level advisory locks as "Never". ([PgBouncer docs](https://www.pgbouncer.org/features.html))
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](https://www.pgbouncer.org/config.html))
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](https://www.pgbouncer.org/faq.html))

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](https://github.com/pgdogdev/pgdog))
LISTEN/NOTIFY works because PgDog runs its own pub/sub queue for connected clients. ([PgDog docs](https://docs.pgdog.dev/features/connection-pooler/))
There is a catch: when a client takes an advisory lock, PgDog pins that server connection to the client. ([PgDog docs](https://docs.pgdog.dev/features/connection-pooler/transaction-mode/))

## Load balancing and failover

PgDog sends SELECT queries to replicas and everything else to the primary, with 3 strategies for spreading reads. ([PgDog docs](https://pgdog.dev/), [PgDog docs](https://github.com/pgdogdev/pgdog))
A replica that fails a health check leaves the rotation, by default for 5 minutes. ([PgDog docs](https://docs.pgdog.dev/features/load-balancer/healthchecks/))
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](https://github.com/pgdogdev/pgdog))

PgBouncer keeps this outside the pooler. ([PgBouncer docs](https://www.pgbouncer.org/faq.html))
To spread connections across servers, its FAQ suggests DNS round-robin or a TCP load balancer such as HAProxy. ([PgBouncer docs](https://www.pgbouncer.org/faq.html))

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

## 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](https://pgdog.dev/))

Cross-shard transactions can use Postgres two-phase commit so writes land atomically. ([PgDog docs](https://docs.pgdog.dev/features/sharding/))
PgDog can also reshard in the background over logical replication, without downtime. ([PgDog docs](https://github.com/pgdogdev/pgdog))

Plan around the gaps.
Cross-shard SQL support is limited, and some sharding features are still experimental. ([PgDog docs](https://github.com/pgdogdev/pgdog), [PgDog docs](https://docs.pgdog.dev/features/sharding/))
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](https://github.com/pgdogdev/pgdog))

## Performance and threading

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

PgDog is multithreaded on the Tokio async runtime. ([PgDog docs](https://docs.pgdog.dev/features/connection-pooler/))
On its homepage, PgDog claims 50,000+ transactions/s per thread and says a few Postgres connections can serve 100,000+ clients. ([PgDog docs](https://pgdog.dev/))
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](https://www.pgbouncer.org/config.html))
It also supports LDAP and PAM, plus TLS client certificates. ([PgBouncer docs](https://www.pgbouncer.org/config.html))

PgDog lists five authentication methods, including AWS RDS IAM tokens for its own connection to Postgres. ([PgDog docs](https://github.com/pgdogdev/pgdog))
Both sides of a PgDog connection can use TLS. ([PgDog docs](https://docs.pgdog.dev/features/tls/))

## Operations and upgrades

PgBouncer is managed through an admin console of SHOW commands. ([PgBouncer docs](https://www.pgbouncer.org/usage.html))
Its docs describe a zero-downtime rolling restart of two PgBouncer processes using SHUTDOWN WAIT_FOR_CLIENTS. ([PgBouncer docs](https://www.pgbouncer.org/usage.html), [PgBouncer docs](https://www.pgbouncer.org/faq.html))
The PgBouncer 1.26.0 release removed the deprecated online restart (-R). ([PgBouncer docs](https://www.pgbouncer.org))

PgDog offers a PgBouncer-style admin database, an OpenMetrics endpoint and OTEL export. ([PgDog docs](https://github.com/pgdogdev/pgdog))
New PgDog releases ship every week, on Thursday. ([PgDog docs](https://docs.pgdog.dev/installation/))
Its Linux binaries need glibc 2.39 or later. ([PgDog docs](https://docs.pgdog.dev/installation/))

## 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](https://github.com/pgdogdev/pgdog))
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](https://docs.pgdog.dev/enterprise_edition/), [PgDog docs](https://pgdog.dev/enterprise))
For PgDog Enterprise pricing, the docs say to contact PgDog. ([PgDog docs](https://docs.pgdog.dev/enterprise_edition/))

PgBouncer is distributed under the ISC License. ([PgBouncer docs](https://github.com/pgbouncer/pgbouncer/blob/master/COPYRIGHT))
Its community page points to its GitHub issue tracker and Stack Overflow for support. ([PgBouncer docs](https://www.pgbouncer.org/community.html))

## Migration impact

PgDog reads 2 configuration files: pgdog.toml for hosts and sharding, and users.toml for usernames and passwords. ([PgDog docs](https://github.com/pgdogdev/pgdog))
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](https://github.com/pgdogdev/pgdog))

## Where PgDog wins

- SET, LISTEN/NOTIFY and advisory locks keep working in transaction mode. ([PgDog docs](https://docs.pgdog.dev/))
- Read routing and failover detection live in the same executable as the pooler. ([PgDog docs](https://pgdog.dev/), [PgDog docs](https://github.com/pgdogdev/pgdog))
- Sharding comes with two-phase commit and online resharding. ([PgDog docs](https://docs.pgdog.dev/features/sharding/), [PgDog docs](https://github.com/pgdogdev/pgdog))

## Where PgBouncer wins

- Its footprint is 2 kB per connection by default. ([PgBouncer docs](https://www.pgbouncer.org/features.html))
- Client authentication can go through LDAP or PAM. ([PgBouncer docs](https://www.pgbouncer.org/config.html))
- Many OS distributions package it, and it runs as a Windows service. ([PgBouncer docs](https://www.pgbouncer.org/downloads/), [PgBouncer docs](https://www.pgbouncer.org/install.html))

## Limitations to plan for

- PgDog pins a server connection while a client holds an advisory lock. ([PgDog docs](https://docs.pgdog.dev/features/connection-pooler/transaction-mode/))
- That lock detection needs PgDog's query parser, which is on when the deployment is sharded or uses read/write split. ([PgDog docs](https://docs.pgdog.dev/features/connection-pooler/transaction-mode/))
- PgDog's cross-shard SQL is limited. ([PgDog docs](https://github.com/pgdogdev/pgdog))
- PgBouncer uses one CPU core per instance, so scaling up means running several processes. ([PgBouncer docs](https://www.pgbouncer.org/config.html))
- PgBouncer has no internal failover detection. ([PgBouncer docs](https://www.pgbouncer.org/faq.html))

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](https://github.com/pgdogdev/pgdog))
That admin database isn't fully compatible, and configuration moves to pgdog.toml and users.toml. ([PgDog docs](https://github.com/pgdogdev/pgdog))

### Does PgBouncer support LISTEN/NOTIFY in transaction pooling?

PgBouncer's feature map marks LISTEN as "Never" in transaction pooling. ([PgBouncer docs](https://www.pgbouncer.org/features.html))
PgDog supports LISTEN/NOTIFY in transaction mode through its own pub/sub queue. ([PgDog docs](https://docs.pgdog.dev/features/connection-pooler/))

## 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](https://pgdog.dev/)). ([PgDog docs](https://pgdog.dev/), [PgDog docs](https://docs.pgdog.dev/))


## Sources

- [docs.pgdog.dev](https://docs.pgdog.dev/)
- [pgdog.dev](https://pgdog.dev/)
- [pgbouncer.org](https://www.pgbouncer.org)
- [pgbouncer.org/usage.html](https://www.pgbouncer.org/usage.html)
- [pgbouncer.org/features.html](https://www.pgbouncer.org/features.html)
- [pgbouncer.org/config.html](https://www.pgbouncer.org/config.html)
- [pgbouncer.org/faq.html](https://www.pgbouncer.org/faq.html)
- [github.com/pgdogdev/pgdog](https://github.com/pgdogdev/pgdog)
- [docs.pgdog.dev/features/connection-pooler](https://docs.pgdog.dev/features/connection-pooler/)
- [docs.pgdog.dev/enterprise_edition](https://docs.pgdog.dev/enterprise_edition/)
- [github.com/pgbouncer/pgbouncer/blob/master/COPYRIGHT](https://github.com/pgbouncer/pgbouncer/blob/master/COPYRIGHT)
- [docs.pgdog.dev/features/connection-pooler/transaction-mode](https://docs.pgdog.dev/features/connection-pooler/transaction-mode/)
- [docs.pgdog.dev/features/load-balancer/healthchecks](https://docs.pgdog.dev/features/load-balancer/healthchecks/)
- [docs.pgdog.dev/features/sharding](https://docs.pgdog.dev/features/sharding/)
- [docs.pgdog.dev/features/tls](https://docs.pgdog.dev/features/tls/)
- [docs.pgdog.dev/installation](https://docs.pgdog.dev/installation/)
- [pgdog.dev/enterprise](https://pgdog.dev/enterprise)
- [pgbouncer.org/community.html](https://www.pgbouncer.org/community.html)
- [pgbouncer.org/downloads](https://www.pgbouncer.org/downloads/)
- [pgbouncer.org/install.html](https://www.pgbouncer.org/install.html)
