Ram
All topicsTopic 16 / 24
Intermediate 1 minute

Database Sharding

Sharding partitions one logical dataset across multiple database nodes. Each shard owns a subset of records, often selected by a key such as tenant ID or user ID. This can spread storage and write load beyond one machine. It also makes queries, rebalancing, cross-shard transactions, and uneven 'hot' keys more complicated.

Key idea

A shard key decides where each record lives, so choosing it is a major design decision.

See it in one picture

Follow the arrows

Real-world example

A global SaaS platform might place tenants across shards by tenant_id. Requests can route directly to the right shard, while reports spanning every tenant need a more expensive fan-out.

Quick check

Can you spot it?

0/2 answered
Question 1

1. What does sharding split?

Question 2

2. What determines placement?