Course contents
On this page
Course reference

Learning path: build a database engine

The concepts, prerequisites, and implementation milestones behind the course.

The destination is a small database engine whose behavior you can explain and test. Begin with one running program on one machine. Add storage, query execution, and transaction machinery before extending the design across machines.

The course outline supplies the reading order and Previous/Next navigation. This guide explains the dependencies and sources behind that order. It is our synthesis, not a university-endorsed curriculum.

What is ready to read

The new opening sequence teaches rows, keys, SQL reads and writes, joins, transaction boundaries, an in-memory scan, byte encoding, and saving a file. Three additional bridges introduce pages, the reason for a search tree, and the need for a consistent report. These pages use original examples and worked answers.

The ticket, index, and MVCC pilots link to those foundations. The remaining 45 chapters now also have focused core explanations, worked values, diagrams, and prediction answers. Each links to its original detailed chapter as an extended reference. You can follow the core sequence before exploring those specialist sections. Encountering an unexplained term is still a reason to improve the course, not evidence that you should already know it.

Follow the dependencies

  1. Describe the behavior

    A product row → a query → a purchase that succeeds or fails together.

  2. Build the local mechanisms

    A scan in memory → encoded records → file pages → buffered pages → indexed access → query execution.

  3. Keep the promises under failure

    Interrupted writes → recovery → overlapping transactions → isolation and version visibility.

  4. Make the engine dependable

    Failure tests, restore procedures, diagnostics, bounded resource use, and compatible upgrades. Replication comes after the local guarantees are clear.

Each later mechanism depends on behavior or a representation introduced earlier. Tests accompany each component, rather than waiting until the final stage.

Know what each stage should let you do

StageA useful check before moving onImplementation milestone
What a database promisesPredict a query result and explain a partially completed purchaseState the supported operations and constraints
A tiny engine in memoryTrace a present key and a missing key through a scanRead records from an in-memory collection
Rows become bytesDecode a record and detect a truncated oneSave and reopen a declared record format
Data exceeds memoryExplain the difference between a page and its frameLoad pages into a bounded buffer pool
Finding rows efficientlyTrace a boundary key and explain insertion costsImplement and validate one index
Executing queriesTrace rows through a plan and explain its resultExecute a small, explicit SQL subset
Surviving interruptionState which acknowledged changes must surviveRecover under a documented failure model
Overlapping transactionsExplain an anomaly and the rule that prevents itCheck concurrent histories against the chosen isolation promise
Making the engine operableRestore data and explain an observed bottleneckExercise recovery, limits, diagnostics, and compatibility
Engines across machinesExplain why a lost reply does not prove a failed requestBuild a replicated component and test partial failures

Implementation work happens locally, outside this reading site. Early Python traces make operations visible; they do not commit the eventual engine to Python. C++ is a direct route into CMU’s supplied projects, but requires preparation in ownership, memory, I/O, debugging, and synchronization. Choose that implementation route deliberately rather than treating those skills as “basic programming.”

Bridges into the three pilots

DestinationLearn firstQuestion that motivates it
One ticket, two buyersReading and changing rows, then transactionsWhat if both requests act on the same earlier stock count?
B+ tree lookupPages and frames, then sorted search and insertionHow can a page guide a search without moving an entire sorted collection on every insert?
Versioned readsTransactions, then two reads in one reportHow can reads of committed values still produce an inconsistent report?

Sources with different jobs

Roadmap.sh’s SQL map, PostgreSQL map, and Backend map help check coverage. Their full tool lists are not prerequisites for building our first engine. In particular, database administration and engine implementation have different learning goals.

MaterialUse it for
Harvard CS50 SQLA first explanation of queries, relationships, schema design, and updates
MIT 6.006 notes, Spring 2020Selected data structures, searching, sorting, hashing, and cost analysis
Wisconsin OSTEPProcesses, memory, concurrency, files, and persistence, introduced when needed
Berkeley CS186Relational engine explanations and exercises; some course media may require university access
CMU 15-445, Spring 2026Storage, indexes, execution, transactions, and recovery; a principal implementation reference
MIT 6.5840, Spring 2026The later distributed-systems branch, after local systems and concurrency foundations
SQLite atomic commit and testingProduction examples of persistence assumptions, crash testing, and malformed-input testing
PostgreSQL administration and Google SRE workbookWhat operators need from a reliable engine and service

External courses are supporting materials, not a requirement to finish several university degrees before beginning. This site should provide the explanation needed for each core page. Link to the original materials for further study rather than copying their documents or publicizing university assignment solutions. CMU asks that its project solutions remain private.

How we will judge the explanations

A page should show the problem, work through actual values, explain the mechanism, then change one condition so you can predict the result. Diagrams should reveal structure or changing state. Necessary definitions belong before their first use; a glossary is a reference, not a substitute for teaching.

Later lessons should ask you to recall earlier ideas. For instance, learning about B+ tree splits should reuse your understanding of page capacity. The IES learning guide supports connecting concrete and abstract representations, combining graphics with explanations, worked examples, retrieval, and spaced review. Applying these ideas still requires feedback from a real reader.

A teaching engine and a production engine

Passing component exercises is evidence of learning. Production use needs evidence about the actual implementation, its supported platforms, and its stated failure assumptions.

That includes interrupted and failed I/O, exhausted memory, malformed files and queries, overlapping operations, repeatable recovery, verified restores, and storage-format upgrades. Compare supported query results with a reference engine while accounting for dialect differences and unspecified ordering. Measure performance with a named workload and correctness settings.

CMU’s concurrency assignment explicitly leaves persistent undo logs outside that project’s requirements. It is a useful reminder that a successful educational component is not a complete durability implementation. No lesson count or reading certificate can replace that engineering work.