PgDog is an open source connection pooler, load balancer, and sharding proxy for PostgreSQL. It's Postgres-compliant, fast, secure and built in the open by a community of database engineers.
We've been working on PgDog for over a year. It's running in production, serving over 2M queries per second across dozens of deployments. Sharding is working, too! Building PgDog in the open has been really great: our users and customers contribute features and bug fixes, every day. Give it a try and let us know what you think!
Report
PgDog's connection pooling and transparent query routing is technically elegant. It removes the need to re-architect your data layer, which saves weeks of migration work. We've hit connection saturation issues under bursty SaaS workloads and this seems like a real fix. How does PgDog handle long-running transactions during a shard rebalance or failover?
If the transaction is taking too long, we break it. Failovers are immediate, so we break the transaction and bubble up the error to the client.
Report
The "scale Postgres without changing your app" framing is the part that matters for teams that can't stop to re-architect — connection pooling plus transparent routing means the app stays naive. My one question as I'd drop this in front of an existing service: how does PgDog handle a single transaction that touches rows on multiple shards — does it coordinate the cross-shard write, or is keeping a transaction inside one shard still the app's job? Curious where the sharding proxy's transparency stops.
We support cross-shard transactions, so as long as we support the query your app is sending, it should work.
Report
Good that cross-shard transactions are supported. The part I'd want to pin down before pointing an app at it is the "as long as we support the query" boundary - is there a documented set of unsupported query shapes (multi-shard joins, certain CTEs/window functions), and does an unsupported query fail loudly at parse/routing time or silently land on a single shard?
Report
I appreciate the honesty in positioning this as scaling without forcing app changes. Usually, "seamless scaling" secretly means rewriting half your queries to fit a proprietary router, so tackling this transparently at the protocol level makes a ton of sense.
Wondering what the tradeoff on latency looks like under the hood, when it's intercepting traffic on the fly, is there a noticeable overhead for high frequency, simple reads compared to just hitting standard postgres?
Very little overhead. If you're running a connection pooler already (e.g., pgbouncer), you won't notice much of a difference.
Report
Congrats on the launch! Running a SaaS on Neon's serverless Postgres — connection pooling is one of those things you don't think about until it bites you in production. Couple of questions: how does PgDog handle the connection limit quirks of serverless Postgres vs traditional dedicated instances? And is there a recommended setup for a Next.js + Prisma stack?
PgDog works with all Postgres databases, incl. the serverless kind. It'll try to minimize the number of connections it needs in both, so you should see quite a bit of an improvement if you deploy it in front of Neon, for example.
Report
How do you plan to handle failover and redundancy in PgDog, especially in cases where the load balancer or connection pooler itself becomes a single point of failure?
We run multiple instances. They are config-driven, so they don't talk to each other. HA by design.
Report
the config-driven instances not talking to each other is a clean HA story, but during a shard rebalance does every instance get the new shard map atomically, or is there a window where two instances disagree on where a shard actually lives?
We synchronize config updates in the enterprise edition, so there shouldn't be a situation when the sharding map on one instance is different from another.
speaks the real postgres wire protocol so nothing else in the stack has to change, and the pooling/load balancing actually holds up under real production traffic based on what the maker's shared.
PgDog
PgDog's connection pooling and transparent query routing is technically elegant. It removes the need to re-architect your data layer, which saves weeks of migration work. We've hit connection saturation issues under bursty SaaS workloads and this seems like a real fix. How does PgDog handle long-running transactions during a shard rebalance or failover?
PgDog
If the transaction is taking too long, we break it. Failovers are immediate, so we break the transaction and bubble up the error to the client.
The "scale Postgres without changing your app" framing is the part that matters for teams that can't stop to re-architect — connection pooling plus transparent routing means the app stays naive. My one question as I'd drop this in front of an existing service: how does PgDog handle a single transaction that touches rows on multiple shards — does it coordinate the cross-shard write, or is keeping a transaction inside one shard still the app's job? Curious where the sharding proxy's transparency stops.
PgDog
We support cross-shard transactions, so as long as we support the query your app is sending, it should work.
Good that cross-shard transactions are supported. The part I'd want to pin down before pointing an app at it is the "as long as we support the query" boundary - is there a documented set of unsupported query shapes (multi-shard joins, certain CTEs/window functions), and does an unsupported query fail loudly at parse/routing time or silently land on a single shard?
I appreciate the honesty in positioning this as scaling without forcing app changes. Usually, "seamless scaling" secretly means rewriting half your queries to fit a proprietary router, so tackling this transparently at the protocol level makes a ton of sense.
Wondering what the tradeoff on latency looks like under the hood, when it's intercepting traffic on the fly, is there a noticeable overhead for high frequency, simple reads compared to just hitting standard postgres?
PgDog
Very little overhead. If you're running a connection pooler already (e.g., pgbouncer), you won't notice much of a difference.
Congrats on the launch! Running a SaaS on Neon's serverless Postgres — connection pooling is one of those things you don't think about until it bites you in production. Couple of questions: how does PgDog handle the connection limit quirks of serverless Postgres vs traditional dedicated instances? And is there a recommended setup for a Next.js + Prisma stack?
PgDog
PgDog works with all Postgres databases, incl. the serverless kind. It'll try to minimize the number of connections it needs in both, so you should see quite a bit of an improvement if you deploy it in front of Neon, for example.
How do you plan to handle failover and redundancy in PgDog, especially in cases where the load balancer or connection pooler itself becomes a single point of failure?
PgDog
We run multiple instances. They are config-driven, so they don't talk to each other. HA by design.
the config-driven instances not talking to each other is a clean HA story, but during a shard rebalance does every instance get the new shard map atomically, or is there a window where two instances disagree on where a shard actually lives?
PgDog
We synchronize config updates in the enterprise edition, so there shouldn't be a situation when the sharding map on one instance is different from another.