PgDog
Scale Postgres without changing the app
Details
- External ID
- 47123631
- Source
- HN
- Company
- —
- Product
- PgDog
- Website domain
- github.com
- Launched
- Feb. 23, 2026
- Cohort
- —
- Upvotes
- 326
- Upvotes percentile
- 0.9797843665768194
- Tags
- —
- Fetched at
- Sept. 7, 2026, 9:25 p.m.
- Updated at
- Sept. 7, 2026, 9:25 p.m.
Description
Hey HN! Lev and Justin here, authors of PgDog (https://pgdog.dev/), a connection pooler, load balancer and database sharder for PostgreSQL. If you build apps with a lot of traffic, you know the first thing to break is the database. We are solving this with a network proxy that works without requiring application code changes or database migrations.Our post from last year: https://news.ycombinator.com/item?id=44099187The most important update: we are in production. Sharding is used a lot, with direct-to-shard queries (one shard per query) working pretty much all the time. Cross-shard (or multi-database) queries are still a work in progress, but we are making headway.Aggregate functions like count(), min(), max(), avg(), stddev() and variance() are working, without refactoring the app. PgDog calculates the aggregate in-transit, while transparently rewriting queries to fetch any missing info. For example, multi-database average calculation requires a total count of rows to calculate the original sum. PgDog will add count() to the query, if it’s not there already, and remove it from the rows sent to the app.Sorting and grouping works, including DISTINCT, if the columns(s) are referenced in the result. Over 10 data types are supported, like, timestamp(tz), all integers, varchar, etc.Cross-shard writes, including schema changes (CREATE/DROP/ALTER), are now atomic and synchronized between all shards with two-phase commit. PgDog keeps track of the transaction state internally and will rollback the transaction if the first phase fails. You don’t need to monkeypatch your ORM to use this: PgDog will intercept the COMMIT statement and execute PREPARE TRANSACTION and COMMIT PREPARED instead.Omnisharded tables, a.k.a replicated or mirrored (identical on all shards), support atomic reads and writes. That’s important because most databases can’t be completely sharded and will have some common data on all databases that has to be kept in-sync.Multi-tuple inserts, e.g., INSERT INTO table_x VALUES ($1, $2), ($3, $4), are split by our query rewriter and distributed to their respective shards automatically. They are used by ORMs like Prisma, Sequelize, and others, so those now work without code changes too.Sharding keys can be mutated. PgDog will intercept and rewrite the update statement into 3 queries, SELECT, INSERT, and DELETE, moving the row between shards. If you’re using Citus (for everyone else, Citus is a Postgres extension for sharding databases), this might be worth a look.If you’re like us and prefer integers to UUIDs for your primary keys, we built a cross-shard unique sequence, directly inside PgDog. It uses the system clock (and a couple other inputs), can be called like a Postgres function, and will automatically inject values into queries, so ORMs like ActiveRecord will continue to work out of the box. It’s monotonically increasing, just like a real Postgres sequence, and can generate up to 4 million numbers per second with a range of 69.73 years, so no need to migrate to UUIDv7 just yet. INSERT INTO my_table (id, created_at) VALUES (pgdog.unique_id(), now()); Resharding is now built-in. We can move gigabytes of tables per second, by parallelizing logical replication streams across replicas. This is really cool! Last time we tried this at Instacart, it took over two weeks to move 10 TB between two machines. Now, we can do this in just a few hours, in big part thanks to the work of the core team that added support for logical replication slots to streaming replicas in Postgres 16.Sharding hardly works without a good load balancer. PgDog can monitor replicas and move write traffic to a promoted primary during a failover. This works with managed Postgres, like RDS (incl. Aurora), Azure Pg, GCP Cloud SQL, etc., because it just polls each instance with “SELECT pg_is_in_recovery()”. Primary election is not supported yet, so if you’re self-hosting with Patroni, you should keep it around for now, but you don’t need to run HAProxy in front of the DBs anymore.The load balancer is getting pretty smart and can handle edge cases like SELECT FOR UPDATE and CTEs with INSERT/UPDATE statements, but if you still prefer to handle your read/write separation in code, you can do that too with manual routing. This works by giving PgDog a hint at runtime: a connection parameter (-c pgdog.role=primary), SET statement, or a query comment. If you have multiple connection pools in your app, you can replace them with just one connection to PgDog instead. For multi-threaded Python/Ruby/Go apps, this helps by reducing memory usage, I/O and context switching overhead.Speaking of connection pooling, PgDog can automatically rollback unfinished transactions and drain and re-sync partially sent queries, all in an effort to preserve connections to the database. If you’ve seen Postgres go to 100% CPU because of a connection storm caused by an application crash, this might be for you. Draining connections works by receiving and discarding rows from abandoned queries and sending the Sync message via the Postgres wire protocol, which clears the query context and returns the connection to a normal state.PgDog is open source and welcomes contributions and feedback in any form. As always, all features are configurable and can be turned off/on, so should you choose to give it a try, you can do so at your own pace. Our docs (https://docs.pgdog.dev) should help too.Thanks for reading and happy hacking!
Enrichment
- Theme
- database infrastructure and developer tools
- Vertical
- Horizontal
- Function
- Data infrastructure
- Audience
- B2B
- AI stance
- Not AI
- Project type
- Commercial product
- Normalized one-liner
- scale postgres without changing application
- Manually corrected
- False
Could you build this?
No Building a high-throughput, wire-compatible PostgreSQL proxy with connection pooling, multi-node sharding, and transaction management requires deep systems programming and database internals expertise.
What it would actually take: Requires writing a high-concurrency network daemon (typically in Rust or C/Go) using non-blocking async I/O to parse the PostgreSQL wire protocol, handle SSL termination, and track transaction state. The hard parts are distributed query routing, distributed transaction isolation, connection failover, and zero-downtime connection pooling under heavy load without introducing latency or race conditions. This requires specialized database systems engineers.
Discussion
20 comments analyzed.
Competitors mentioned: Citus, PlanetScale, CockroachDB, PostgREST, Supabase
Concerns raised: Cross-shard foreign key constraints not yet fully supported, Cross-shard queries expensive due to network laws of physics, Analytics/unsharding data back at analytics layer is complex, Maintaining feature parity with Postgres is a maintenance burden, Shards going down for maintenance is incident-level event
Feature requests: Support for more data types beyond BIGINT/VARCHAR/UUID for sharding keys, Built-in load balancing across read replicas, Cross-shard analytics/OLAP query support, Zero-downtime maintenance and blue/green deployment support, Logical replication sink support for analytics (Clickhouse, etc.)
Competitors
Other products that read as similar to this one — 105 launches clear the similarity bar, closest 8 shown.
Attention rank: #3 of 106 (itself plus its competitors, highest first — normalized so YC and Product Hunt are compared fairly).
Launched 116 days after the earliest competitor.
- PgDog · ph · 2026-07-14 · 227 upvotes · similarity 0.70
- Managed Postgres with native ClickHouse integration · hn · 2026-01-22 · 45 upvotes · similarity 0.48
- PostgreSQL performance and cost across 23 EC2 instance types · hn · 2026-07-07 · 97 upvotes · similarity 0.48
- PostgreSQL Migrator · ph · 2026-09-17 · 2 upvotes · similarity 0.43
- Pgclaw · hn · 2026-02-12 · 48 upvotes · similarity 0.43
- justPostgres · github · 2026-09-09 · 46 upvotes · similarity 0.43
- Pgrust, Postgres in Rust (passing 100% of Postgres regression tests) · hn · 2026-06-25 · 6 upvotes · similarity 0.43
- Pq · hn · 2026-02-22 · 5 upvotes · similarity 0.43
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a data infrastructure tool for Media & entertainment yet.