The engine you will build, one layer per chapter
A map of the mini engine: file format, records, log, pages, index, cache, search and executor, and the order you will add them.
More on Build a mini database engine
- Find row 2 without reading every byte
- TLV: every value says its own type and length
- Insert, select, delete and update on a plain file
- A write-ahead log lets a crashed insert be replayed
- Cut the table file into pages the engine can find
- A B-tree index file turns a key into a file offset
- A small LRU cache saves most disk reads
- A full-text index maps each word to the rows that hold it
- From SQL text to rows: parse, plan and iterators
Keep learning
Overview
SQL text Parser, planner, iterators Turn the string into a tree, pick scan or index, pull rows one at a time. B-tree index Map a key to the (page, slot) where its record lives, in a few page reads. Buffer pool Keep hot pages in memory so most reads never reach the disk. Data pages Cut the file into fixed-size pages with a header and a slot directory. Insert, select, delete and update rows inside the file. Byte format (TLV) Write each value as type, length, value so any reader can decode it. Write-ahead log (side) Write the intent first, so a crash can be replayed on restart. Full-text index (side) Map each word to the rows that contain it. Before anything else, a row must survive as bytes in a file and be read back. With a byte format, insert, select, delete and update become file operations. Writes can be torn by a crash. The log is added while the file is still simple. A single long file is slow to search and to update. Pages give every record an address. Addresses make an index possible: key → (page, slot). Index and table both read pages, so one cache under both pays off twice. Words need their own index. It reuses rows, pages and the cache. Last, because a query plan can only pick between access paths that already exist.
Recap
The engine is a stack: SQL → executor → index → cache → pages → records → bytes, with a log and a word index on the side. One table (users, 12 rows) and one class (MiniDb) run through every chapter. The build order follows dependencies: bytes first, SQL last. Locks, MVCC, a cost-based optimizer and replication are what separate this from a production engine.
More courses
- Jobs, linked to lessons — Browse jobs where every requirement links to the chapter that teaches it. See how ready you are, how long the gap takes to close, and which listings look stale.
- Match a job post to courses — Paste a job post. Each skill is matched to a track here and put in learning order, foundations first.
- React patterns from open source — Patterns extracted from Material UI, Radix, React Aria, React Hook Form, Redux Toolkit, TanStack, and Next.js — not slides about hooks.
- System Design — Core concepts first (SQL vs NoSQL, CAP, indexing, replication, sharding), then designs grouped by what carries them: the database, Redis, Kafka, or many services.
- NestJS: build a real API — One ticket-booking API, built in order: a plain Node server first, then NestJS modules, validation, a real database, and the features real clients lean on.
- Microservices — Microservice patterns one diagram at a time: how to split a monolith, how services talk, and how data stays consistent without distributed transactions.
- Kafka — A beginner-to-senior path through event logs, reliable delivery, production operations, and disaster recovery.
- AI engineering for software engineers — Eight free reads, in order, for software engineers moving into AI: when to build an agent, how to build one, how to test it, and how the model works underneath.
- Frontend system design — How a UI is sliced when it is a product, not a page: ownership of state, cache, routes, and what happens when the network lies.
- TypeScript in depth — The type system as a design tool. Inference, narrowing, generics, and the errors that mean the model is wrong — not a catalog of utility types.
- CSS in depth — See the box, then the page. Visual chapters from the box model through Flexbox surprises, Grid, selectors, and units, then backgrounds, shapes, and visual effects, each with a playground.
- Accessibility — Foundations first (WCAG in plain words, semantic HTML, lists, alt text), then hands-on HTML labs, a full pass of WAI-ARIA 1.3, and a final fix-the-page challenge.
- Docker — What an image is, why layers cache, and how containers find each other on a network.
- Redis — Fifteen Redis patterns, one picture each: cache, session, lock, counter, rate limiter, queue, and when Redis is the wrong tool.
- Kubernetes — Kubernetes from zero to operators: why it exists, Pods, Deployments and Services, then configuration, networking, storage, scheduling, scaling and security.
- AWS — AWS networking in plain English. A VPC is a gated housing society: streets are subnets, the Internet Gateway is the main gate, and a route table is the signboard.
- Networking: the NetRoute game — NetRoute is a packet logistics game. You wire up computers, switches, routers, firewalls and gateways, set each device, and watch glowing packets travel. If a packet gets dropped, the game shows you which header field was wrong.