🆕 This chapter is part of the WIP book:
Build Your Own Database From Scratch Subscribe to get notified of new chapters and the book's release.
Build Your Own Database From Scratch Subscribe to get notified of new chapters and the book's release.
🔥 My other Book: Build Your Own Redis
Build Your Own Database From Scratch
Persistence, Indexing, Concurrency
Introduction
Databases are not black boxes. Understand them by building your own from scratch!
This book contains a walk-through of a minimal persistent database implementation. The implementation is incremental. We start with a B-Tree, then add a new concept with each chapter, and eventually go from a simple KV to a mini relational DB.
Although the book is short and the implementation is minimal, it aims to cover three important topics:
- Persistence. How not to lose or corrupt your data. Recovering from a crash.
- Indexing. Efficiently querying and manipulating your data. (B-tree).
- Concurrency. How to handle multiple (large number of) clients. And transactions.
Contents
Part I: Simple KV Store (Completed)
- Introduction
- Files vs Databases
- Indexing
- B-Tree: The Ideas
- B-Tree: The Practice (Part I)
- B-Tree: The Practice (Part II)
- Persist to Disk
- Free List: Reusing Pages
Part II: Mini Relational DB (Work in Progress)
- Rows and Columns
- Range Query
- Secondary Index
- Transactions
- Concurrent Readers and Writers
- Query Language
Work in Progress…
Subscribe to be notified of new chapters and print releases.
[🔔 Subscribe]
Pre-order the ebook via Leanpub.
[🙂 Pre-Order]

See also:
codecrafters.io offers “Build Your Own X” courses in many programming languages.
Including Redis, Git, SQLite, Docker, and more.
Check it out
codecrafters.io offers “Build Your Own X” courses in many programming languages.
Including Redis, Git, SQLite, Docker, and more.