LOAD-BEARINGfree
Tier 312 lessons, about 159 minutes of reading · checkpoint at the top

The Data Layer

Where the data actually lives. Storage engines, indexes, transactions, and choosing a database for reasons you can defend.

Units on this floor

  1. B-Tree vs LSM: how rows are stored3.01 · 13 min

    Here's a secret that demystifies the entire database landscape: underneath the hundreds of database products, there are basically two ways to physically store rows on disk. Once you know…

  2. Indexes and what they cost3.02 · 13 min

    An index is the reason a query over a billion rows can return in two milliseconds — and also the reason your writes mysteriously got slow after "someone optimised the database." Both facts…

  3. SQL vs NoSQL: the real decision tree3.03 · 13 min

    Few debates generate more heat and less light than "SQL vs NoSQL." Strip away a decade of marketing and tribal identity, and what remains is a set of concrete trades. Let's lay out what…

  4. Transactions and isolation levels3.04 · 14 min

    Everyone can expand ACID: Atomicity (all or nothing), Consistency (constraints hold), Isolation (concurrent transactions don't corrupt each other), Durability (committed survives a crash)…

  5. Normalise, then denormalise on purpose3.05 · 12 min

    Normalisation says: store each fact exactly once. Denormalisation says: store it several times so reads get cheap. Presented as rivals, they're actually a sequence — normalise first, then…

  6. The connection ceiling, and why pgbouncer exists3.06 · 13 min

    Tier 4 is about to teach you that the application tier scales horizontally: add servers, serve more users. There is a limit hiding underneath that promise, and it is one of the most common…

  7. Storing history: soft deletes, audit tables, temporal data3.07 · 13 min

    UPDATE and DELETE destroy information. That is what they are for, and for most of a system's life it is exactly right. Then someone asks what a customer's address was when the order…

  8. Object storage: where the bytes live3.08 · 13 min

    Everything so far in this tier has been about rows — small, structured, queried by their contents. A forty-megabyte video is none of those things. It is a sequence of bytes with a name…

  9. Search: the inverted index and the reindex you owe3.09 · 14 min

    Somebody asks for a search box. The first implementation is WHERE title LIKE '%term%', and it works on the laptop dataset. It cannot survive contact with production for two independent…

  10. Time-series and append-heavy data3.10 · 13 min

    Metrics, clickstream, IoT readings, audit events, financial ticks. They look like ordinary rows and they behave nothing like them, which is why a schema that works beautifully for orders…

  11. MVCC: how readers stop blocking writers3.11 · 14 min

    Lesson 3.04 handed you the isolation dial and told you which anomalies each setting permits. It did not say how the database delivers any of it. There are two families of answer, and which…

  12. The disk underneath the database3.12 · 14 min

    Tier 0 established that random access loses to sequential, and Lesson 3.01 showed you the two storage engines built around that fact. Neither said anything about the device they run on. In…