Start With One Database

One database server takes you further than the headlines suggest. Indexes, partitioning, read replicas and a bigger machine each buy real room, and every one of them is cheaper than sharding, which changes how every query in the application is written. So sharding is the last thing to reach for, not the first.

The signal that you've arrived is specific: writes, not reads, have outgrown one machine, and the cheaper fixes are used up. From there the decisions come in a fixed order: the key, the routing, where related data lives, and how to move data later. The table above lists the signals. This article explains keys and placement, then answers each situation with a way to check it.

Before you shard
  • Your single DB is at 80% CPU and you're scared to deploy
  • You think sharding by user_id % N is fine until you have to add a shard
  • One of your shards is at 95% disk and the rest are at 30%
  • You can't do a cross-shard JOIN and didn't plan for that

This is the sharding playbook — when to actually shard, how to pick a key, hash vs range vs directory, and how to rebalance without a 3-day outage.