PgDog
A horizontal scaling tool for PostgreSQL that combines connection pooling, load balancing, and distributed sharding in a single executable.
About PgDog
PgDog is a horizontal scaling tool for PostgreSQL that combines connection pooling, load balancing, and distributed database capabilities in a single executable. As a connection pool, it lets a small number of Postgres connections serve more than 100,000 clients without breaking Postgres functionality; the vendor says a single thread can process more than 50,000 transactions per second. As a load balancer, it distributes read queries across replicas, detects replication lag and primary failover, and gives applications a single entry point. In distributed mode, PgDog extracts the shard key from queries and routes them to the correct shard; queries without a shard key run in parallel on all databases. Cross-shard transactions use two-phase commit for atomic writes, with automatic rollback on errors; the vendor says ACID compliance is maintained at scale.
Best for
Best use cases
Stably support 100,000-level client connections with a small number of database connections
Distribute read traffic across multiple read-only replicas while detecting replication lag and primary failover
Route queries to the corresponding shard by shard key, and execute queries without a shard key in parallel
Run cross-shard transactions and automatically roll back on errors to ensure atomicity
Features
Connection pooling
Share a small number of Postgres connections across 100,000+ clients without breaking Postgres functionality.
Read load balancing
Distribute read queries across replicas, detect replication lag, hardware failures, and primary failover, with one endpoint for all queries.
Smart sharding
Extract the shard key directly from the query and send it to the correct shard; queries without a shard key run in parallel on all databases.
Cross-shard transactions
Use native Postgres prepared transactions and two-phase commit to write atomically to all shards, with automatic rollback on errors.
Pros
- The vendor says a single thread can process more than 50,000 transactions per second, using a multithreaded asynchronous architecture
- Serve more than 100,000 clients with few connections without breaking Postgres functionality
- All queries need only one endpoint, with automatic detection of replication lag, hardware failures, and primary failover
- Cross-shard transactions use two-phase commit, with automatic rollback on any error