Skip to content
BENIBIX Learn

Database Sharding

Development🗃️ DatabasesScaling

Also known as Sharding, Shard, Horizontal Partitioning

The rows of a big database, split across many servers. Each holds a part.

Think of it like

Think of it like splitting a class list across three teachers by surname. A to H goes to one, and so on.

Example

A chat app with 500 million users puts users 1 to 100 million on shard one, and so on. Each server only carries a fifth of the load.

Why it matters

There is a limit to how big one server can get. Sharding is how the largest apps go past it.

Definition

Sharding splits the rows of one big database across several servers. Each server, called a shard, holds only part of the data. A shard key, like the user id, decides which shard each row lives on. This lets a database grow past what one server can hold or handle. It adds a lot of work, so most teams shard only when nothing else is enough.

Common mistake

Sharding too early. It makes joins, reports and changes much harder, and a bigger server or a replica is often enough.

Key takeaways

  1. 1
    Split the rows. Each shard holds a part.
  2. 2
    A shard key. It decides where each row goes.
  3. 3
    Last resort. Try bigger servers and replicas first.

Compare