Database Internals
Why does the database behave this way internally? The practical layer teaches how to use databases correctly; this layer sits underneath it and derives every mechanism — pages, B+ trees, the buffer pool, WAL, MVCC, LSM trees, the query planner, replication — from the problem it solves. An interactive systems textbook, not a glossary.
Two layers, one domain
The learner should never feel these are separate products. Every practical lesson carries a “See how this works internally →” link; every internals lesson links back to where you meet it in practice.
Database Engineering
│
├── SQL · Data Modeling · Indexes · Transactions · Query Optimization
├── PostgreSQL · Redis · NoSQL · Scaling
│
└── Database Internals
├── Storage ├── Pages ├── Records
├── B+ Trees ├── Buffer Mgmt ├── WAL
├── MVCC ├── Recovery ├── LSM Trees
├── Query Engine └── Distributed InternalsStart here
Descend from a normal question
The defining experience: start where an engineer starts and go all the way down into the machinery.
- Slow querypractical
- ↓Execution planpractical
- ↓Sequential scaninternals
- ↓Pagesinternals
- ↓Storage readsinternals
- Index scanpractical
- ↓B+ treeinternals
- ↓Internal pagesinternals
- ↓Leaf pageinternals
- ↓Buffer poolinternals
- ↓Recordinternals
- COMMITpractical
- ↓Transactioninternals
- ↓WALinternals
- ↓Durabilityinternals
- ↓Dirty pageinternals
- ↓Recoveryinternals
- DELETEpractical
- ↓MVCCinternals
- ↓Dead tuplesinternals
- ↓VACUUMinternals
- ↓Slotted pageinternals
How every internals lesson is taught
Never a definition first. The learner understands why a mechanism exists before memorising its name.
- Problem↓
- Naive solution↓
- Why it breaks↓
- Better idea↓
- Internal mechanism↓
- Trade-offs↓
- Real database
- ProblemScanning millions of rows is slow.
- Naive solutionMaintain searchable metadata: a sorted array of key → row.
- Why it breaksThe index is larger than memory; inserting into a sorted array shifts everything.
- Better ideaOrganise the index into storage-friendly pages, with a page of separators above.
- Internal mechanismA B+ tree: fanout ~200, height 3–4, linked leaves.
- Trade-offsEvery write maintains it; splits cost pages; low-selectivity lookups lose to a scan.
- Real databasePostgreSQL nbtree, InnoDB clustered index, SQLite B-tree.
Every lesson also offers four depths — Overview, Intermediate, Advanced, Internals — and labels every simulated number as an educational simulation, and every engine-specific section as PostgreSQL or InnoDB rather than “databases”.
Modules
Connected to the rest of Engineer Atlas
The same structure, seen from the database side.