Datadog has open sourced PG Proxy, the PostgreSQL proxy its database platform team has run in production, under the Apache 2.0 licence. Datadog says it handles 4 trillion queries a month, more than 200 million authentications a day and more than 600,000 open client connections, in front of thousands of PostgreSQL hosts and hundreds of logical clusters. The table in its post counts that first figure as messages, not queries.
It’s written in Go. You can run the supplied binary as a transaction pooler, or embed the Go library and plug in your own authentication, routing and telemetry. Datadog calls the binary a drop-in replacement for PgBouncer, though it’s configured with a YAML or JSON file, not PgBouncer’s INI file.
Below: why Datadog built it, what’s in the release and what stays internal, my own run of it against a replica and PgBouncer, and the limits listed in its docs.
Why Datadog built it
Before PG Proxy, Datadog’s applications reached PostgreSQL by direct connection or through a mix of PgBouncer for pooling, HAProxy for load balancing and traffic shifting, and Envoy for discovery and health checks. Datadog says each piece had its own configuration, metrics and scaling behaviour, and nothing gave a consistent view of a request across all three. Authentication relied on shared static database credentials, so access couldn’t be tied to a single service.
Migrations were the other pain. Moving databases from cloud-managed PostgreSQL to Kubernetes meant coordinating DNS updates, proxy changes and application redeploys, then waiting on application teams to switch endpoints before cleanup could finish.

The project’s documentation says the PostgreSQL Platform team started building PG Proxy in 2023 after hitting limits in existing tools, PgBouncer among them. Datadog names two. When it began, PgBouncer didn’t support protocol-level named prepared statements in transaction pooling, so Datadog built that in; PgBouncer added it in version 1.21.0 in October 2023. And PgBouncer is single-threaded, so using more cores means running more processes and re-sizing pools to stay inside PostgreSQL’s connection limits. A single PG Proxy instance can use several cores.
What it does
| Feature | What Datadog’s docs say |
|---|---|
| Transaction pooling | Many client sessions share a smaller pool of backend connections. A session holds a connection only for the length of a transaction. |
| Prepared statements | Named statements keep working when transactions land on different backend connections. Unnamed ones are parsed again per transaction unless a client opts into caching. |
| Read routing | Client-facing database names map to clusters. With routing on, a transaction that opens with a plain SELECT, SHOW or BEGIN READ ONLY can go to a replica. About 90 per cent of eligible reads go to replicas, and a read falls back to the primary if no replica connection frees up within 50 ms. |
| Central migration control | Applications keep the same proxy address and database name while operators repoint the backend. Datadog’s own workflows stop new logins, drain active transactions and shift read and write routing. |
| Limits and shutdown | Client sessions are capped separately from backend connections, and sessions drain at transaction boundaries on a planned stop. |
| Authentication and TLS | TLS and SCRAM-SHA-256 for client connections, plus hooks to connect your own identity system. |
| Telemetry | Logs, metrics and query traces over OpenTelemetry or native Datadog. |
| Traffic mirroring | Replay live traffic against a separate database without slowing clients. Go library only. |
Tracing gets the most room in Datadog’s post. PG Proxy records spans for handling protocol messages, running and proxying queries, and returning results, and when a client supplies trace context those spans can join the application’s trace. An engineer can then tell time spent waiting on the database from time spent handing rows back to the application.
What’s in the release and what isn’t
What you get is a production-ready application and a Go library with extension points for destination selection, discovery, health checks, authentication and telemetry. Datadog’s JWT-based service sign-in and its client helpers aren’t part of it. The public library gives you the hooks to build your own policies.

Datadog’s internal load-shedding and autoscaling systems are also separate from the release, and Datadog says it plans to add support for those capabilities in a future release. Its Database Monitoring integration may follow. The docs front page opens with a warning: this is early development, and configuration and Go APIs may change between releases.
I ran it
I built PG Proxy from source, put it in front of PostgreSQL 16 with a streaming replica, and ran PgBouncer 1.22.0 beside it for comparison. Everything ran on one four-core cloud machine. The pgbench figures are a smoke test, one run per cell, not a benchmark.
The build needs Go 1.26 and a C compiler, because the proxy uses CGO. It compiled in about a minute, and the README quick start worked as written: validate the config, start the proxy, connect with psql.

Pooling. I ramped up to 150 client sessions through the proxy with the pool capped at 10, each session running a small query every quarter of a second, and sampled PostgreSQL’s connection count throughout. The database never saw more than 10. With 100 busy pgbench clients, the count was 10 as well.

Prepared statements. pgbench in prepared mode ran 20 clients over the 10-connection pool for five seconds. It processed 182,705 transactions with no failures, and the prepared-mode runs against the default configuration in the table below also finished with no failed transactions.
Read routing. I added the replica to the cluster, turned on dynamic routing with a client startup option, and ran 200 show port statements. 182 reached the replica and 18 stayed on the primary, which fits the 90 per cent split in the docs.

The classifier only sends a statement to a replica when it recognises it as a read. A select inet_server_port() went to the primary all 50 times, because the docs list only a short set of functions as read-only and a first function outside that list keeps the statement on the primary. A BEGIN READ ONLY transaction reached the replica in 35 of 40 tries, and a plain BEGIN never does.
Speed. I ran pgbench’s select-only script at scale 10, eight seconds per run, with 10 and 100 clients in simple, extended and prepared modes. The pool was 10 connections for both poolers. “Default” is the README configuration. “Tuned” adds the three settings Datadog’s benchmark page lists: reset_mode: dynamic, reply_buffer_pool: true and client_disconnect_timer: true.
| Protocol, clients | Direct to Postgres | PgBouncer 1.22.0 | PG Proxy default | PG Proxy tuned |
|---|---|---|---|---|
| simple, 10 | 68,225 | 33,957 | 19,955 | 29,382 |
| simple, 100 | 56,385 | 46,511 | 20,084 | 32,748 |
| extended, 10 | 67,745 | 32,154 | 16,669 | 25,778 |
| extended, 100 | 52,270 | 43,615 | 18,364 | 27,168 |
| prepared, 10 | 94,608 | 35,364 | 22,972 | 33,879 |
| prepared, 100 | 79,438 | 42,469 | 23,720 | 37,242 |

PgBouncer was faster than PG Proxy in every row, and a direct connection beat both, which is normal for tiny queries over loopback. PG Proxy’s default configuration reached between 42 and 65 per cent of PgBouncer’s throughput. The tuned configuration reached between 62 and 96 per cent.
Datadog’s own benchmark page reports 165,000 to 196,000 transactions a second at 10 and 100 clients for a primary-key select on a 16-core EC2 instance with PG Proxy limited to four CPUs. My machine had four cores shared by the load generator, the pooler and the database, so the absolute numbers aren’t comparable. The page doesn’t compare PG Proxy with another pooler, and Datadog’s pitch isn’t speed against PgBouncer. It’s one component that replaces three and takes hooks for identity and telemetry.
The tuned settings come with a catch in Datadog’s own limitations page: with reset_mode: dynamic, a setting changed inside a function or trigger can leak to the next client of the same connection. I’d start on the default.
I didn’t test TLS and SCRAM, the Go library, traffic mirroring or the trace exporters. These are the commands, config and settings I ran:
go build -o bin/pg-proxy ./cmd/pg-proxy
./bin/pg-proxy -config proxy.yaml -validate-config
./bin/pg-proxy -config proxy.yaml
pgbench -i -s 10 postgres
pgbench -h 127.0.0.1 -p 15432 -U postgres -S -M prepared -c 100 -j 2 -T 8 local_db
# proxy.yaml (the README config, plus a streaming replica)
databases:
- name: primary
host: 127.0.0.1
port: 5432
dbname: postgres
username: postgres
password: postgres
sslmode: disable
max_conns: 10
- name: replica
host: 127.0.0.1
port: 5433
dbname: postgres
username: postgres
password: postgres
sslmode: disable
max_conns: 10
clusters:
local:
primary: primary
replicas:
- replica
logical_databases:
local_db:
cluster: local
proxy:
listener_address: 127.0.0.1:15432
# tuned run: reset_mode: dynamic on the primary, and under proxy:
# reply_buffer_pool: true
# client_disconnect_timer: true
# pgbouncer.ini
pool_mode = transaction
default_pool_size = 10
max_prepared_statements = 100
Limits to read before you try it
Datadog’s own docs list where PG Proxy falls short. These matter most before a trial:
- The binary reads its configuration once at startup and doesn’t reload it. Changes mean stopping it with SIGTERM, which drains sessions, and starting it again. A SIGHUP doesn’t reload, unlike PgBouncer. It kills the process at once.
- Replica reads can be stale. A recent write doesn’t pin later transactions to the primary, so anything that must read its own write needs a destination that routes to the primary.
- Routing is a first-statement heuristic. Named prepared statements aren’t classified, so clients such as pgx in its default mode send their reads to the main backend.
- SQL-level PREPARE and EXECUTE, temporary tables, LISTEN and session-level advisory locks don’t carry across transactions.
- After authentication there’s no limit on client message size, so a large enough message can exhaust the proxy’s memory.
- SCRAM-SHA-256-PLUS channel binding isn’t implemented.
- Traces can contain raw SQL and error messages. Turning off bind-parameter capture doesn’t remove literal values from the statement text, and there’s no general redaction.
How it compares
| Pooler | Pooling | Routing |
|---|---|---|
| PG Proxy | Transaction | SQL classification, weighted read clusters, replica pool selection |
| PgBouncer | Session, transaction, statement | Database-to-host mappings; read and write routing is left to the client or surrounding infrastructure |
| Pgpool-II | Connections reused between sessions | Read and write routing with replica balancing |
| Odyssey | Session, transaction | Database and user rules, primary and standby selection through target_session_attrs |
| PgDog | Session, transaction | Read and write splitting, replica balancing and sharding |
My read: if you run one application against one PostgreSQL cluster behind PgBouncer, nothing in my numbers gives you a reason to move. PG Proxy is built for platform teams that want pooling, routing and their own identity and telemetry in a single Go process, and the clearest example is Datadog’s own: repointing a database without waiting for application teams to redeploy.
Sources: Datadog, Open sourcing PG Proxy, the repository, PG Proxy documentation, PgBouncer changelog.




