Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Choosing a datastore: the workload picks the book

Chapters

Narration

Back at the stall there was one book, and every number in the shop went into it. A real system asks fourteen different questions before lunch, and no single book answers all of them well. So the useful unit is not the database. It is one question meeting one store, and there are only three things that can happen. Keep the questions fixed and change only the book. Give a ruled relational table five ordinary questions. Fetch one order by id: cheap, the key is the index. Every order placed between two and three: cheap, the rows are already sorted. Move money between two balances: cheap, and that row is the whole reason this engine exists. Then search the notes for a word, or average a year of baskets. Both of those are a full scan, every time. Now change nothing except the book. Hand the same five questions to a wall of keyed boxes and the pattern inverts. The lookup by id is instant, the money row is not even available, and the range has no order to walk. Hand them to a store kept a column at a time and the year of baskets is the cheap one while the single order is the expensive one. No column of this grid is all green, and that is the finding. Underneath every one of those verdicts is a second question nobody asks: which engine. A balanced tree of sorted pages, updated in place, makes reads and ranges excellent and turns every write into a seek. A log of sorted files, only ever appended and merged later, takes writes at the speed of the disk and makes a read check several files before it answers. Read optimised or write optimised. Pick by your ratio, not by the logo. And the third question is what you promise while two people write at once. There is a ladder. The bottom rung lets a reader see work that was never committed. Each rung above it kills one more way to be wrong, and the top rung behaves as if the writers queued politely, one at a time. Every rung up costs throughput. Under a cut wire the same dial has a different name, and you have already met it: consistency, or availability. Which leaves the third verdict, and it is the expensive one. Some questions this store cannot answer at any price. Ask it for the people followed by the people you follow, two hops out, and every book on the counter either scans the world or shrugs. That is not a tuning problem. That is the shelf telling you it is missing a model, and the answer is a second system: another store, another copy of the data, another thing to keep in step, another pager at three in the morning. So the answer to which database is never a name. It is which question, how often it is asked, and what it costs you on the day the answer is no.

Saved in this browser, and to your account when you sign in.