pgdogdev /pgdog
PostgreSQL connection pooler, load balancer and database sharder.
★ 5,614⑂ 314👁 22⑃ 1,479● 521▤ 64
+0
Daily
5,614
stars
314
forks
22
watchers
1,479
prs
521
issues
64
releases
README
PgDog is an open source proxy for scaling PostgreSQL. It supports connection pooling, load balancing queries and sharding entire databases. Written in Rust, PgDog is fast, secure and can manage thousands of connections on commodity hardware. Documentation &128216; PgDog documentation can be found here. Any questions? Chat with us on Discord. Enterprise edition &127970; Enterprise edition (EE) documentation is available here. Changelog is available here. Quick start Kubernetes Helm chart is here. To install it, run: bash helm repo add pgdogdev https://helm.pgdog.dev helm install pgdog pgdogdev/pgdog AWS If you're using AWS RDS, you can deploy PgDog using one of two supported methods: 1. Helm chart with EKS, or a self-hosted Kubernetes cluster 2. Terraform module to deploy PgDog on ECS Try in Docker You can try PgDog quickly using Docker. Install Docker Compose and run: docker-compose up Once started, you can connect to PgDog with psql or any other PostgreSQL client: PGPASSWORD=postgres psql -h 127.0.0.1 -p 6432 -U postgres The demo comes with 3 shards and 2 sharded tables: sql INSERT INTO users (id, email) VALUES (1, '[email protected]'); INSERT INTO payments (id, user_id, amount) VALUES (1, 1, 100.0); SELECT FROM users WHERE id = 1; SELECT FROM payments WHERE user_id = 1; Features &128216; Configuration All PgDog features are configurable and can be turned on and off. PgDog requires 2 configuration files to operate: 1. pgdog.toml: hosts, sharding configuration, and other settings 2. users.toml: usernames and passwords Example Most options have reasonable defaults, so a basic configuration for a single user and database running on the same machine is pretty short: pgdog.toml toml [general] port = 6432 default_pool_size = 10 [[databases]] name = "pgdog" host = "127.0.0.1" users.toml toml [[users]] name = "alice" database = "pgdog" password = "hunter2" If a database in pgdog.toml doesn't have a user in users.toml, the connection pool for that database will not be created and users won't be able to connect. If you'd like to try it out locally, create the database and user like so: sql CREATE DATABASE pgdog; CREATE USER pgdog PASSWORD 'pgdog' LOGIN; Transaction pooling &128216; Transactions Like PgBouncer, PgDog supports transaction (and session) pooling, allowing thousands of clients to use just a few PostgreSQL server connections. Unlike PgBouncer, PgDog can parse and handle SET statements and startup options, ensuring session state is set correctly when sharing server connections between clients with different parameters. PgDog also has more advanced connection recovery options, like automatic abandoned transaction rollbacks and connection re-synchronization to avoid churning server connections during an application crash. Load balancer &128216; Load balancer PgDog is an application layer (OSI Level 7) load balancer for PostgreSQL. It understands the Postgres protocol, can proxy multiple re
Top issues
#375Improve JDBC Postgres driver support18 comments · 2025-08-29#1588FIPS compliant support for mTLS clients and RDS IAM backends12 comments · 2026-09-18#828Adding new shards to an existing cluster (rebalancing)9 comments · 2026-03-13#912[Load balancer] Sticky reads8 comments · 2026-04-17#1976Dependency version pinning question7 comments · 2026-11-05#1479Expand environment variables in configuration files6 comments · 2026-09-02#1254[documentation] Trying out admin commands using the Docker demo6 comments · 2026-07-22#207[Query engine] Merge/sort for sorting6 comments · 2025-06-05
Discussions
#2010How ro/rw routing works?1 comments · 2026-11-11#1804Some OS packages1 comments · 2026-10-14#1451pgdog 0.1.56 performance test0 comments · 2026-08-28#1171Discovery mechanism for Primary/Replica1 comments · 2026-07-09#1075Feature Request: Transparent Micro-Batching for Single INSERTs1 comments · 2026-06-14#892Recommendations on how to configure PHP (Doctrine) to work with PGDog as a connection pooler?2 comments · 2026-04-13
Latest release
v0.1.65 v0.1.65 2026-11-12Peformance - More performance improvements in the hot path, reducing memory allocations, CPU instructions, and mutex contention required to serve a query @jkaczman - Use unnest() in cross-shard subqueries instead of injecting raw values, producing a massive improvement in performance @jkaczman Features - Cross-shard GROUP BY now supports aggregation on columns not specified in the SELECT clause @murex971 - Add support for cross-shard CTEs @jkaczman - Add support for derived tables in subqueries @jkaczman - Add support for cross-shard GROUP BY with HAVING clause @murex971 - Add