10.5K ·GitHub
What is this?
This is a hands-on tutorial that walks through writing a SQLite clone from scratch in C, teaching how a real database works internally by building one chapter by chapter.
Is this a working database I can use, or just a teaching project?
It's a teaching project: you build a minimal but functional database (with a REPL, B-tree storage, and simple SQL-like commands) purely to learn how databases work, not to replace SQLite.
How do I go through the tutorial?
Read the rendered tutorial online chapter by chapter while following along in the C source code in this repo; there are also notes for running the tutorial website locally.
Do I need anything besides a C compiler to follow along?
You need a C compiler and Make to build the database code; the test suite is written in Ruby, so Ruby is needed if you want to run the tests.
Is this a feature-complete database I can rely on?
No, it only implements a small subset of what a real database does (basic storage, a B-tree, and a simple command interpreter), so it's not meant for production use.
Who is this tutorial meant for?
It's aimed at programmers comfortable with C who want to understand database internals like B-trees, pages, and query execution by building one themselves.
What topics does the tutorial cover?
It covers building a REPL, an in-memory and persistent storage format, pages, B-tree indexing, and a simple SQL-like command interpreter, mirroring how SQLite's internals work.
Why did the author build this instead of just reading SQLite's source code?
The README frames it as a learning exercise: building the pieces yourself in small, incremental chapters makes it easier to grasp concepts like paging and B-trees than reading finished production code.
Can I just read the code without following the write-up?
Yes, the repository contains the working C source alongside the tutorial, so you can read the final implementation directly even without working through each chapter.
What are similar projects?
lytlnyblOS, redis-3.0-annotated, hello-algo, os-tutorial, TeachYourselfCS-CN, swift-algorithm-club, Go, asm-lessons
Which topics is it in?
storage-engine, from-scratch, low-level, ruby, data-structures, systems-programming, algorithms, computer-science, programming, c, sqlite, guide