Sharding and shard keys
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
choose a shard key that fits the main queries.
Planned topics
- Sharding splits data across servers by a key; each shard handles a share of writes.
- A good key has high cardinality, even distribution, and appears in the main queries.
- Cross-shard queries, transactions, and joins become expensive or impossible.
- Candidates for orders: customer id, order id (hash), region or tenant.
Draft outline details
Demonstration
a table: key, even spread, query fit, risk, e.g. customer id fits "my orders" but makes a large customer hot.
Check your understanding
What breaks if the shard key is not in the common query?
Show answer
The query must hit every shard.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.