SQL vs NoSQL
maang.io System Design Series
"SQL vs NoSQL" is the most common — and most misunderstood — database question in interviews. This deep dive replaces the false binary with a framework: relational vs the four NoSQL families (key-value, document, wide-column, graph), ACID vs BASE, rigid vs flexible schema, and vertical vs horizontal scaling. The answer is almost always "it depends — here's on what."
This deep dive comes in three parts:
- Foundations & Core Concepts — the families, ACID vs BASE, and the scaling models.
- Internals — schema-on-read, join-vs-embed, and polyglot persistence, with worked examples.
- Interview — Staff/Principal Q&A: picking a store and defending the trade-offs.
SQL vs NoSQL — Part 2: Internals & Implementation
maang.io System Design Series
What is this?
Back to the central library and its branches. In Part 1 we saw what each choice gives you. Now we go into the back rooms and watch the machinery — because "SQL vs NoSQL" isn't a philosophy, it's a set of concrete engineering mechanisms, and a Staff engineer is expected to know them cold. Why can the central library answer any question you invent? Because of the meticulous index at its heart. Why can a branch absorb a firehose of deliveries? Because it files them differently. Same goods, different back rooms.
Two internal decisions explain almost everything downstream: how the store lays bytes on disk (its storage engine) and how it coordinates correctness across concurrent operations and multiple machines (its transaction and replication machinery). Get those two and you can predict a store's strengths and its failure modes without reading its manual.
The one-line idea: The relational world is built on the B+tree — a structure optimized for reading a value that lives in exactly one place, which is what makes flexible queries, joins, and in-place ACID updates natural. Much of the NoSQL world is built on the LSM-tree — optimized for appending writes cheaply and reconciling later — which is what makes horizontal write-scale natural and joins unnatural. The rest is consequences.
Let's open both back rooms.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson