Get the latest tech news

The Great Re-shard: adding Postgres capacity (again) with zero downtime (2023)


Why and how we horizontally re-sharded our databases

This allowed us to comfortably handle our expected traffic growth and reduce both CPU and IOPS utilization dramatically, giving us headroom to endure the spike and many months into the future. We had to do the updates as many small steps to avoid overwhelming the database at any point, but luckily, PgBouncer is fairly stateless, so the migration just meant moving new traffic over, then waiting for connections to drain. Interestingly, we found that distributing load across more machines reveals outliers in database consumption (i.e., some spaces in certain shards being responsible for an outsized impact on CPU is exaggerated in this world).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Postgres

Postgres

Photo of downtime

downtime

Photo of shard

shard

Related news:

News photo

Postgres as a Graph Database: (Ab)Using PgRouting

News photo

EdgeDB is now Gel and Postgres is the future

News photo

A Language Server for Postgres