Sharding Is Hard: Let's Make It Easier!
summary
A multi‑clinic healthcare app splits a single Postgres into shards by choosing clinic ID as the shard key so visits and audit_logs live per clinic, reducing write hotspots; reads use replicas, writes stay local, and cross‑clinic tables like billing remain on the primary. Routing can be done in Rails (sharding since 6.1) with a stored shard map or pushed to a proxy like PG Dog, which supports resharding and two‑phase commit but still leaves cross‑shard joins slow and transactions non‑atomic.
AI-written summary · about
