Skip to content

Volume ITechnology

7.5.1 — Key-Value and Document Stores ​

A team moves their orders from PostgreSQL to MongoDB because "it scales better". Six months later they need to know total revenue per region per month, and discover the answer requires reading every document.

They did not pick the wrong database. They picked one that is fast at the questions it was designed for, and then asked a question it was not designed for.

That is the whole NoSQL trade, in two sentences. A relational database lets you store the data first and decide the questions later, because it can join and filter any way you like. Most NoSQL databases ask you to decide the questions first, and lay the data out on disk to answer exactly those, very fast. In return you get something real: easy scaling across many machines, or a data shape that matches your code. Section 3 answers the revenue question in MongoDB, so you can see what "requires reading every document" costs and how an index changes it.

1. Where NoSQL came from, and what "schemaless" really means ​

Around 2005–2010 several companies hit the same wall: a single relational server could not hold their data, and sharding it by hand was painful because joins, transactions and foreign keys all stop working once rows live on different machines. Amazon's Dynamo paper (2007) and Google's Bigtable paper (2006) described systems that gave up features in order to spread across machines automatically.

The name is unfortunate. "NoSQL" was a conference hashtag, later softened to "not only SQL". What the systems actually gave up was not SQL — several have query languages now — but joins, multi-row transactions, and a schema the database enforces.

And "schemaless" is the most misleading word in the field. There is always a schema. The only question is who enforces it:

  • Relational — the database enforces it. A bad write fails.
  • Document — your application enforces it. A bad write succeeds, and you find out when something reads it.

The benefit is real. Adding a field needs no migration, and different documents can legitimately have different fields.

The cost arrives later. Each time the code changes the shape, old documents keep their old shape, because nothing rewrites them. After two years, one collection holds several generations of shape side by side. Every piece of code that reads it must cope with all of them.

The fix is to enforce the shape in one deliberate place. Two places work. You can use the database's own validation rules (MongoDB calls this $jsonSchema validation), so a bad write fails, just as in a relational database. Or you can store a version number in each document, and read every document through one function that turns any old shape into the current one:

ts
// Three generations of customer document live in one collection. Read them through one function.
type CustomerV3 = { schemaVersion: 3; id: string; name: { given: string; family: string }; email: string };

function readCustomer(doc: Record<string, unknown>): CustomerV3 {
  const version = (doc.schemaVersion as number | undefined) ?? 1;      // (1)
  if (version === 1) {                                                 // (2)
    const [given, ...rest] = String(doc.fullName).split(" ");
    return { schemaVersion: 3, id: String(doc._id), name: { given, family: rest.join(" ") }, email: String(doc.mail) };
  }
  if (version === 2) {                                                 // (3)
    return { schemaVersion: 3, id: String(doc._id), name: { given: String(doc.firstName), family: String(doc.lastName) }, email: String(doc.email) };
  }
  if (version === 3) return { ...(doc as unknown as CustomerV3), id: String(doc._id) };
  throw new Error(`Unknown customer schemaVersion ${version}`);         // (4)
}

const stored = [
  { _id: "c_1", fullName: "Ana Ruiz", mail: "ana@example.com" },
  { _id: "c_2", schemaVersion: 2, firstName: "Ben", lastName: "Okafor", email: "ben@example.com" },
  { _id: "c_3", schemaVersion: 3, name: { given: "Chen", family: "Li" }, email: "chen@example.com" },
];
for (const doc of stored) {
  const c = readCustomer(doc);
  console.log(c.id, c.name.family, c.email);
}

(1) The first generation was written before anyone thought of versions, so a missing number means version 1. (2) Version 1 kept the whole name in one string and called the email mail. (3) Version 2 split the name into two fields. (4) A version this code has never heard of stops loudly, instead of returning a half-empty customer.

It prints:

c_1 Ruiz ana@example.com
c_2 Okafor ben@example.com
c_3 Li chen@example.com

The rest of the program only ever sees version 3. That is the whole idea: the messy history is handled in one function, not in every screen and report. This pattern is called upcasting on read, and Chapter 10.8.4 uses the same idea for old event formats.

2. Key-value stores ​

The simplest possible database: get(key), put(key, value), delete(key). The value is bytes the store does not interpret.

Because the interface is that small, the implementation can be extremely fast and easy to spread across machines. Hash the key, and you know which machine holds it — no coordination, no lookup table (Chapter 10.6 covers consistent hashing, which is how this survives adding machines).

What you give up is everything that needs to look inside the value. No querying by a field, no sorting by anything but the key, no joins, no aggregation. If you want "all orders over £100" you must have built that index yourself, as another key.

Where they genuinely win:

  • Caching — Redis and Memcached. Chapter 7.6 is the whole story.
  • Sessions — a session id maps to a blob, always fetched whole, always by that id.
  • Feature flags, configuration, rate-limit counters — small values read constantly.
  • Very large simple stores — DynamoDB and Riak, where the access is always by a known key.

The design discipline is that the key is the query. In a key-value store you name keys deliberately: user:42:profile, cart:sess_abc, ratelimit:ip:203.0.113.9:2026-08-02T14. Each key shape corresponds to one question you intend to ask. If you find yourself wanting to scan keys to answer something, that question needed its own key.

DynamoDB deserves a specific mention because it is a key-value store with one extra idea that changes how you model. Its primary key can be a partition key alone, or a partition key plus a sort key. Items sharing a partition key are stored together, sorted, so you can fetch a range within one partition cheaply.

PK = "USER#42"   SK = "PROFILE"              → the profile
PK = "USER#42"   SK = "ORDER#2026-08-01#001" → an order
PK = "USER#42"   SK = "ORDER#2026-08-02#004" → another

One query with PK = "USER#42" AND SK begins_with "ORDER#" returns all of a user's orders, oldest first, in one round trip. This is the single-table design idea. Instead of one table per kind of thing, you put related items in the same partition, so each question you need answered is a single read.

It is powerful and it is unforgiving. You must know your questions before you design the keys. A question you did not plan for usually means a new index or rewriting the data.

How DynamoDB actually behaves ​

The model below is small enough to read in one go, and it does the three things that matter: it keeps each partition's items sorted, it answers a prefix query, and it answers a question across partitions through a second index. The real service does the same, spread across many machines:

ts
// A tiny model of how DynamoDB stores and queries one table.
type Item = { PK: string; SK: string; GSI1PK?: string; GSI1SK?: string; version?: number; [k: string]: unknown };

class Table {
  private partitions = new Map<string, Item[]>();                     // (1)

  put(item: Item, expectedVersion?: number): void {
    const rows = this.partitions.get(item.PK) ?? [];
    const existing = rows.find((r) => r.SK === item.SK);
    if (expectedVersion !== undefined && existing?.version !== expectedVersion) {
      throw new Error(`ConditionalCheckFailed: ${item.PK} ${item.SK}`); // (2)
    }
    const next = rows.filter((r) => r.SK !== item.SK).concat(item);
    next.sort((a, b) => (a.SK < b.SK ? -1 : 1));                      // (3)
    this.partitions.set(item.PK, next);
  }

  query(pk: string, skPrefix = ""): Item[] {
    return (this.partitions.get(pk) ?? []).filter((r) => r.SK.startsWith(skPrefix)); // (4)
  }

  queryIndex(gsiPk: string): Item[] {                                  // (5)
    return [...this.partitions.values()].flat()
      .filter((r) => r.GSI1PK === gsiPk)
      .sort((a, b) => ((a.GSI1SK ?? "") < (b.GSI1SK ?? "") ? -1 : 1));
  }
}

const t = new Table();
t.put({ PK: "USER#42", SK: "PROFILE", name: "Ana Ruiz", version: 1 });
t.put({ PK: "USER#42", SK: "ORDER#2026-08-02#004", total: 3798,
        GSI1PK: "STATUS#shipped", GSI1SK: "2026-08-02" });
t.put({ PK: "USER#42", SK: "ORDER#2026-08-01#001", total: 2499,
        GSI1PK: "STATUS#pending", GSI1SK: "2026-08-01" });
t.put({ PK: "USER#7", SK: "ORDER#2026-08-03#009", total: 1899,
        GSI1PK: "STATUS#pending", GSI1SK: "2026-08-03" });

console.log("Ana's orders:", t.query("USER#42", "ORDER#").map((i) => i.SK));
console.log("Pending orders, all users:", t.queryIndex("STATUS#pending").map((i) => `${i.PK} ${i.SK}`));

t.put({ PK: "USER#42", SK: "PROFILE", name: "Ana Ruiz-Lopez", version: 2 }, 1);   // (6)
try {
  t.put({ PK: "USER#42", SK: "PROFILE", name: "Ana R.", version: 2 }, 1);
} catch (e) {
  console.log((e as Error).message);
}

(1) Each partition key maps to its own list of items. In the real service, DynamoDB hashes the partition key to choose which machine holds that list. (2) A conditional write: "save this only if the stored version is still 1". (3) Items inside a partition are always kept sorted by sort key. That is what makes a range or prefix query cheap: the matching items sit next to each other. (4) A query names one partition, then reads a slice of it. It never looks at other partitions. (5) A global secondary index (GSI) answers a question that crosses partitions, here "every pending order". DynamoDB keeps a second copy of the items, arranged by GSI1PK and GSI1SK instead. This model scans to fake that, and the real service maintains it as you write. (6) Two people edit Ana's profile at once. Both read version 1. The first save succeeds and moves it to version 2. The second save still expects version 1, so it is refused instead of silently overwriting the first person's change.

It prints:

Ana's orders: [ 'ORDER#2026-08-01#001', 'ORDER#2026-08-02#004' ]
Pending orders, all users: [ 'USER#42 ORDER#2026-08-01#001', 'USER#7 ORDER#2026-08-03#009' ]
ConditionalCheckFailed: USER#42 PROFILE

The orders came out in date order even though they were saved out of order. The date is part of the sort key, and the partition is kept sorted.

The facts about the real service that interviewers and outages both test:

  1. An item is at most 400 KB. Large blobs go in object storage, with the key stored in the item.
  2. Each partition has a speed limit: about 3,000 reads and 1,000 writes per second. A partition key that everyone writes to, such as today's date, hits that limit however much capacity the table has. This is the hot partition problem.
  3. Reads are eventually consistent by default, which means a read straight after a write may return the old value. A strongly consistent read costs twice as much and always returns the latest value. Reads from a global secondary index are always eventually consistent, because the index is copied in the background.
  4. A local secondary index keeps the same partition key with a different sort key. It must be created with the table, and it limits each partition key to 10 GB of data. Global indexes can be added at any time, which is why they are the usual choice.
  5. Transactions exist. TransactWriteItems writes up to 100 items, all or nothing, at twice the cost of normal writes.
  6. Capacity is either on-demand, paid per request, or provisioned, paid per hour for a fixed rate with optional auto-scaling. On-demand is the simple default. Provisioned is cheaper for steady, predictable load.
  7. TTL deletes items automatically after a timestamp you store in them, typically within a few days of expiry, at no cost. Streams publish every change for 24 hours, so other services can react to writes (Chapter 10.8.4).

3. Document stores ​

A document store keeps semi-structured records — in practice JSON or a binary form of it — addressed by an id, with the ability to query and index fields inside the document. MongoDB is the common example; Couchbase, Firestore and Amazon DocumentDB are others.

js
// One order, complete
{
  _id: "ord_1001",
  customer: { id: "c_42", name: "Ana Ruiz", email: "ana@x.com" },  // (1)
  lines: [                                                          // (2)
    { sku: "SKU-9", name: "Kettle", qty: 1, unitPriceMinor: 2499 },
    { sku: "SKU-4", name: "Toaster", qty: 2, unitPriceMinor: 1899 }
  ],
  status: "shipped",
  placedAt: ISODate("2026-08-01T10:22:00Z")
}

(1) The customer's details are embedded, not referenced. (2) The lines are an array inside the document rather than rows in another table.

The gain is real: one read gets the whole order. No joins, no round trips, and the object in the database looks like the object in your code. For a document that is always used whole, that is a genuine simplification and a genuine performance win.

The costs are equally real:

Duplicated data drifts. customer.name is copied into every order. Ana changes her name and you must update every document — the exact update anomaly Chapter 7.1 opened with. Sometimes that is correct, because an order should record the name as it was at the time. Deciding which one you mean is the modelling work, and it is the question people skip.

Documents have a size limit — 16 MB in MongoDB — so an array that grows without bound is a design error waiting to fail. A blog post with embedded comments works until a post gets 40,000 comments.

Updating one element of a large array rewrites the document. Storage engines rewrite whole documents on update, so a 2 MB document updated for a 40-byte change writes 2 MB.

Cross-document queries are weak. MongoDB has $lookup, which is a left outer join, and it is genuinely more limited and generally slower than a relational join — it cannot use most of the plan shapes from Chapter 7.2.1.

Answering the opening question ​

The team's question was "total revenue per region per month". MongoDB can answer it with an aggregation pipeline: a list of stages, where each stage takes documents in and passes changed documents on, like an assembly line. This was run against a real MongoDB 8.2 server with four orders:

ts
// Revenue per region per month
const pipeline = [
  { $unwind: "$lines" },                                                       // (1)
  { $group: {                                                                  // (2)
      _id: { region: "$region", month: { $dateToString: { format: "%Y-%m", date: "$placedAt" } } },
      revenueMinor: { $sum: { $multiply: ["$lines.qty", "$lines.unitPriceMinor"] } },
  } },
  { $sort: { "_id.month": 1, "_id.region": 1 } },                              // (3)
];

for (const row of await orders.aggregate(pipeline).toArray()) console.log(JSON.stringify(row));

const plan = await orders.aggregate(pipeline).explain("queryPlanner");          // (4)
console.log("without an index:", JSON.stringify(plan).match(/"stage":"(IXSCAN|COLLSCAN)"/)?.[1]);

await orders.createIndex({ placedAt: 1 });
const recent = [{ $match: { placedAt: { $gte: new Date("2026-09-01") } } }, ...pipeline];
const plan2 = await orders.aggregate(recent).explain("queryPlanner");
console.log("with $match on an indexed field:", JSON.stringify(plan2).match(/"stage":"(IXSCAN|COLLSCAN)"/)?.[1]);

(1) $unwind turns one order with two lines into two documents with one line each, so each line can be added up on its own. (2) $group collects documents that share a region and a month, and adds up quantity × price for each group. Prices are stored in pence, as whole numbers, so no rounding errors creep in. (3) Sort the result by month, then region. (4) explain asks MongoDB how it would run the pipeline, without running it.

It prints:

{"_id":{"region":"EU","month":"2026-08"},"revenueMinor":6297}
{"_id":{"region":"US","month":"2026-08"},"revenueMinor":7497}
{"_id":{"region":"EU","month":"2026-09"},"revenueMinor":4398}
without an index: COLLSCAN
with $match on an indexed field: IXSCAN

COLLSCAN is the "reading every document" from the opening story. It means a collection scan: MongoDB reads every order to answer. With four orders that is instant. With fifty million it takes minutes and pushes everything else out of memory. Adding a $match on an indexed date field turns it into IXSCAN, an index scan that reads only the orders in the range. The fix for a reporting question is usually to narrow it with an indexed filter, or to keep a running total as orders arrive, so the report reads a small summary instead of the raw orders.

Indexes in MongoDB work like the B-tree indexes of Chapter 7.3.2. Two details are specific to documents. An index on a field inside an array, such as lines.sku, is a multikey index: it holds one entry per array element. And for a compound index on several fields, the usual rule of thumb is E-S-R: put fields you test for Equality first, then fields you Sort by, then fields you filter by Range. An index on { region: 1, placedAt: 1 } serves "EU orders since September" well, because the equality on region narrows to one slice, and the range on placedAt reads a continuous run inside it.

Sharding is how MongoDB spreads one collection across machines. You choose a shard key, and MongoDB splits the collection into ranges of that key, called chunks, spread across shards. The choice matters as much as a partition key in Cassandra (Chapter 7.5.2):

  • A query that includes the shard key goes to one shard. A query without it goes to every shard and merges the answers. That is called scatter-gather, and it gets slower as you add shards.
  • A shard key that always increases, such as a timestamp, sends every new write to the last chunk, so one shard does all the work. A hashed shard key spreads writes evenly, at the cost of making range queries on that key scatter-gather.
  • A shard key with too few values, such as country, creates chunks that cannot be split further and grow without limit.

The embed-or-reference decision ​

This is the one modelling rule to carry, and it answers most design questions in a document store:

Embed when the data is owned by the parent, always read with it, and bounded in size. Order lines. An address on a customer. Settings on a user.

Reference when the data is shared, queried independently, unbounded, or updated on a different rhythm. A product referenced by orders. Comments that could number in the tens of thousands. Anything with its own lifecycle.

The three questions that decide it: Is it read with the parent every time? Does it change on the parent's rhythm or its own? Can it grow without limit? Two "yes"es to the first two and a "no" to the third means embed.

A hybrid is often best. Embed the snapshot fields you need for display — the product's name and price at time of order — and keep a reference for the live record. This is not duplication by accident; it is the deliberate decision that an order line should record what was true when it was placed. Chapter 9.7.24 makes the same argument for relational order lines.

Transactions and consistency, accurately ​

Older document stores guaranteed atomicity only for a single document. That is not as limiting as it sounds — if your aggregate is one document, a single-document update is a transaction over the whole aggregate. That is exactly why embedding order lines is attractive: adding a line and updating the total is one atomic write.

MongoDB has supported multi-document ACID transactions since 4.0 (and across shards since 4.2), so the old "NoSQL has no transactions" line is out of date. The caveat is that they cost more than a single-document write and are not the shape the system is optimised for; if every operation needs one, the document model is fighting you.

Read concerns and write concerns are the dial. A MongoDB deployment is normally a replica set: one primary that takes the writes, and usually two secondaries that copy it. If the primary fails, the secondaries elect a new one within seconds. The dial decides how much of that replication you wait for:

  • writeConcern: { w: "majority" } waits until most of the copies have the write. If the primary dies a moment later, the write survives. This has been the default since MongoDB 5.0.
  • w: 1 returns as soon as the primary alone has the write. It is faster. But if the primary dies before copying it, the write is lost when a secondary takes over, even though your code was told it succeeded.
  • readPreference: "secondary" sends reads to the copies, which spreads the load. A copy may be a moment behind, so the read can be stale.

These are choices you make per operation. That is a genuine advantage: a page-view counter can read stale data, and a balance check cannot. It is also a hazard. Code written for an older MongoDB, or copied from a "make it faster" blog post, often sets w: 1 and leaves it there.

4. What you actually give up, stated plainly ​

Across both families, four things:

Joins. You either denormalise (and own the duplication) or you do the join in the application (and pay N round trips — the N+1 problem of Chapter 7.3.2, now unavoidable rather than a mistake).

Ad-hoc queries. A relational schema answers questions nobody thought of. A key-value schema answers exactly the questions its keys encode. This is the single most underweighted cost, because it is invisible on day one and dominant in year two.

Declared constraints. No foreign keys, and usually no cross-document uniqueness. Referential integrity becomes application code, and application code has bugs and multiple authors.

A single obvious source of truth for a fact. With data duplicated across documents, "which copy is right" becomes a real operational question during an incident.

In exchange you get: horizontal scaling that is built in rather than bolted on, writes that do not need a coordinated schema change, a data shape that matches your objects, and — with the right key design — predictable single-digit-millisecond reads at any size.

5. The honest 2026 position ​

Two things have changed since the arguments were formed, and both should update your default.

Relational databases absorbed the document model. PostgreSQL's jsonb (Chapter 7.1 section 5) stores documents, indexes inside them with GIN, and queries them — while keeping joins, transactions and constraints for the parts of your data that want them. For most applications, "PostgreSQL with a jsonb column where the shape genuinely varies" beats splitting the system across two databases.

Relational databases scale further than the 2010 argument assumed. Managed PostgreSQL and MySQL now run comfortably at scales that used to be quoted as impossible, and distributed SQL systems — CockroachDB, Spanner, Vitess, Aurora — offer horizontal scaling while keeping SQL and transactions.

So the defensible default is: start relational. Reach for a key-value store when the access is genuinely by key and the volume or latency demands it, and for a document store when documents genuinely vary and are genuinely read whole. "We might need to scale" is not a reason — it is the reason people give for a decision that costs them the ability to ask new questions.

What the interviewer will push on ​

"When would you choose a document store over a relational database?" When the aggregate is read and written whole, the shape genuinely varies between records, and you do not need to query across documents. Then show the other side: you are deciding your access patterns at design time and paying for new questions later. Anyone who answers "when you need to scale" has not used one in anger.

"What does schemaless actually mean?" That the database does not enforce the schema — the application does. There is always a schema. The tell is naming the two-year cost: four generations of document shape in one collection, all of which every reader must handle, and the mitigation of validating at the boundary.

"Embed or reference?" Embed when owned by the parent, always read with it, and bounded. Reference when shared, independently queried, or unbounded. Then volunteer the hybrid: embed a snapshot of the fields you display, keep a reference for the live record — because an order line should record the price as it was.

"How do you model a user's orders in DynamoDB?" Same partition key, different sort key prefixes, so one query with begins_with returns them in one read. That is single-table design. The tell is stating its condition honestly: you must know the access patterns before you design the keys, and a new pattern later means a new index or a rewrite.

"Do document stores have transactions?" Yes — MongoDB since 4.0, across shards since 4.2. But the more interesting answer is that a single-document write is already atomic over the whole aggregate, which is exactly why embedding is attractive, and if you need multi-document transactions constantly, the document model is the wrong shape for that data.

"Your DynamoDB table has plenty of capacity but writes are being throttled. Why?" A hot partition. Each partition has its own limit of about 1,000 writes per second, so a key that concentrates writes, such as today's date or one popular product, is throttled however large the table is. The fix is to spread the key, for example by adding a suffix from 0 to 9 and reading all ten when you need the total. The tell is knowing the limit is per partition, not per table.

"How do you stop two users overwriting each other's update?" A conditional write with a version number: save only if the stored version is still the one you read, and add one. The loser gets a clear failure and can re-read and retry. DynamoDB calls it a condition expression; MongoDB does the same with a filter on the version field in updateOne. This is optimistic locking, and it needs no locks held between read and write.

"How do you pick a MongoDB shard key?" One that most queries include, so they go to one shard; one with many distinct values, so chunks can split; and one that does not always increase, so new writes do not pile onto the last chunk. A hashed key fixes the last problem and turns range queries on that key into scatter-gather. Naming that trade is the answer.

"What do you give up with NoSQL?" Joins, ad-hoc queries, declared constraints, and one obvious source of truth. Emphasise ad-hoc queries: it is invisible on day one and dominant in year two, when someone asks a question the keys were not designed for.

One thing to volunteer: point out that PostgreSQL's jsonb gives you the document model inside a relational database, with GIN indexes on the document contents, so the choice is rarely all-or-nothing any more. It reframes the question from "which database" to "which parts of my data are actually document-shaped", which is the more useful question.

Recall

  • NoSQL gave up joins, multi-row transactions and an enforced schema in exchange for automatic horizontal scaling. The trade is not about SQL the language.
  • "Schemaless" means the application enforces the schema, not that there is none. The cost lands in year two as several generations of shape in one collection; validate at the boundary.
  • Key-value: get/put/delete on opaque values. The key is the query — name keys after the questions you intend to ask. Scanning keys means a question that needed its own key.
  • DynamoDB's partition key plus sort key keeps related items together and sorted, which is what makes single-table design work — and what makes an unanticipated access pattern expensive.
  • Document stores query and index fields inside the document. One read gets the whole aggregate; the costs are duplicated data drifting, a size limit, whole-document rewrites, and weak cross-document joins.
  • Embed when owned by the parent, read with it, and bounded. Reference when shared, independently queried, or unbounded. The hybrid — embed a snapshot, keep a reference — is usually right, because an order should record the price as it was.
  • A single-document write is atomic over the whole aggregate, which is the real reason embedding is attractive. Multi-document ACID transactions exist in MongoDB 4.0+; needing them constantly means the model is wrong.
  • DynamoDB: 400 KB items, a per-partition limit of about 3,000 reads and 1,000 writes per second, eventually consistent reads by default (strong reads cost double), GSIs always eventually consistent, transactions up to 100 items, and conditional writes for optimistic locking.
  • MongoDB: an aggregation pipeline answers reporting questions, and explain shows COLLSCAN (every document) versus IXSCAN (index). Compound indexes follow E-S-R. w: "majority" is the default since 5.0; w: 1 can lose an acknowledged write. A shard key must be in most queries, have many values, and not always increase.
  • Shape drift is handled in one place: database validation rules, or a version field plus one function that upcasts old documents on read.
  • The real cost of NoSQL is the ad-hoc query you have not thought of yet. Default to relational; PostgreSQL's jsonb with GIN gives the document model without giving up joins and constraints.

Self-test: Who enforces the schema in a document store, and when does that bill arrive? · Name the three questions that decide embed versus reference · Why is PK = USER#42, SK = ORDER#… one read instead of two? · What does a single-document atomic write actually buy you? · Which NoSQL cost is invisible on day one? · What changed since 2010 that should move your default?

Next: 7.5.2 covers the remaining three families — wide-column, graph and time-series — and gives the decision procedure for picking among all of them.

Combine chapters into one PDF

Pick the chapters you want. They print in the order you pick them.

Volume I — Technology
Part 0 — Retention & Notation
Part 1 — Foundations of Computation
Part 2 — Operating Systems
2.1 The Kernel
2.2 Processes
2.3 Threads & Scheduling
2.4 Concurrency Under the Hood
2.5 Memory Management
2.6 File Systems
2.7 Input/Output
2.8 Linux for Engineers
2.9 Windows & macOS in Practice
Part 3 — Languages, Compilers & Runtimes
3.6 JavaScript & V8
3.7 TypeScript
3.8 Node.js Internals
3.13 Python & CPython
3.14 FastAPI & Production Python
Part 4 — Data Structures & Algorithms
4.0 Classic Problems — Before NeetCode
4.4 Arrays & Hashing — Problems
4.5 Two Pointers
4.6 Sliding Window
4.8 Stack — Problems
4.9 Linked List — Problems
4.11 Binary Search — Problems
4.13 Trees
4.14 Tree — Problems
4.15 Trie — Problems
4.17 Heap — Problems
4.18 Backtracking — Problems
4.19 Graphs
4.20 Graph — Problems
4.21 Advanced Graph — Problems
4.23 1-D DP — Problems
4.24 2-D DP — Problems
4.26 Greedy — Problems
4.27 Interval — Problems
4.28 Math & Geometry — Problems
4.30 Bit Manipulation — Problems
Part 5 — Networking & the Web
5.3 IP
5.4 Transport
5.6 HTTP
Part 6 — Frontend Engineering
6.1 Browser Internals
6.2 HTML & CSS Mastery
6.3 JavaScript in the Browser
6.4 React, from First Component to Full Shop
6.5 Frameworks & Rendering
6.8 UI Engineering & Patterns
Part 7 — Databases & Storage
7.2 SQL Mastery
7.3 Storage Engine Internals
7.4 Transactions
7.5 NoSQL Taxonomy
7.8 Analytics & Big Data
Part 8 — Security, Identity & Cryptography
8.2 Cryptography
8.3 Protocols of Trust
8.4 Identity: AuthN & AuthZ
8.5 Application Security
8.6 Infrastructure Security
Part 9 — Software Design (LLD)
9.2 OOP Foundations
9.3 Design Principles
9.4 Design Patterns
9.5 Concurrency
9.6 API Design
9.7 LLD Interview Machines
9.9 Node/Express Production Playbook
Part 10 — Distributed Systems & HLD
10.7 Consistency & Consensus
10.8 Messaging & Microservices
10.14 Caching
Building blocks from the design seat
Part 11 — System Design Case Studies
Part 12 — AI & ML Engineering
12.1 What AI Engineering Is
12.2 The Math You Need
12.3 Classical Machine Learning
12.4 Data for ML
12.5 Deep Learning
12.6 Embeddings & Vector Search
12.7 Transformers & LLMs
12.8 Building with LLMs
12.9 Retrieval-Augmented Generation
12.10 Agents
12.11 Adapting Models
12.12 Production AI
12.13 Multimodal AI
12.14 AI Security & Governance
12.15 Case Studies & Capstone
Part 13 — Cloud, DevOps & Infrastructure
13.11 Git, from First Commit to Team Workflow
Part 14 — Containers: Docker & Kubernetes
14.1 Foundations
14.2 Docker
14.3 Kubernetes
14.4 Kubernetes on Azure
Part 15 — The Craft & Career
Nothing picked yet