Skip to content
Ameen Abozaid
Planned lessonSRC-007-L04

Sharding and shard keys

  • Lesson 4 of 9
  • Senior C
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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.