Skip to content

Part VI — Data at Scale ​

The data layer is where most system designs are really decided. The store you choose fixes which queries are cheap. The shard key fixes what is possible at all. The isolation level fixes what can go wrong when requests run at the same time. All three are costly to change later, so interviewers spend much of a round here.

This section is the distributed half of the subject. Schema design, indexing, query plans and day-to-day SQL belong to Part V. This section assumes them and does not repeat them.

Chapters ​

#ChapterWhat it answers
01Choosing a Datastore and Replicating ItWhich family of store, and what can a reader see while the copies disagree?
02Sharding and Transactions at ScaleWhich shard key will you not regret, and what breaks across machines?

What Interviewers Probe For ​

  • Do you choose from access patterns? "Relational because the queries are varied and money is involved" is a reason. "NoSQL because it scales" is not.
  • Do you know what replication does not buy? Replicas are availability, not backups, and they return stale data by design.
  • Can you defend a shard key? Cardinality, whether the common query carries it, whether it is immutable, and what happens to the account with ten million followers.
  • Do you reach for a distributed transaction? The senior answer is to arrange not to need one.

Reading Order ​

01 → 02, in order. They are the two ways to spread data: copy it or split it. The second half of 02 shows what concurrent writes do to both.

Interview sprint: 02. Shard keys and lost updates are the two questions this section is asked about most.

⚠️ Schema design, indexing and query optimisation are in Part V, at implementation depth. CAP and consistency patterns are in Reliability, Consistency and CAP. This section is only about data that no longer fits on one machine.

The whole book, free to read. Generated from the manuscript on every change.

Your progress

Tick each chapter in the sidebar once you have read and understood it. Your name and email keep the ticks on any device.

Your name and email are stored to save your progress. Nothing else is done with them.