Demo: choosing a shard key for orders
On This Lesson 3 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
pick and test a shard key; prepares SRC-007-LAB1.
Draft outline details
Step by step
- List the main queries: order by id, orders by customer, ops reports by date.
- Analyze real order data for distribution by customer and by order id.
- Planned mistake: choose order id hash because it spreads evenly. Fix: "my orders" now hits all shards; choose customer id with salting for large customers or keep a lookup table.
- Quantify hot-partition risk using the top customers' share.
- Outline resharding and the migration plan.
- Record the decision in an ADR.
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.