Writing a SQLite clone from scratch in Rust
Part 1 — Understanding SQLite and Setting up CLI Application and REPL
Part 2 — SQL Statement and Meta Commands Parser + Error Handling
Let's get the obvious out of the way, why am I doing this? Do I want to develop the next great embedded DB of the 21st century? Not really.
What I cannot create, I do not understand. — Richard Feynman
I am really doing it in order to understand better the works of it, and my goal is to document everything along the way. Wish me luck!
- So how does a database work?
- What format is data saved in? In our case, in memory and on disk.
- When does it mode from memory to disk? How would that work exactly?
- Why we only have one primary key per table? Do you know?
- How does rolling back a transaction work?
- How are indexes formatted? And how do they work?
- When and how does a full table scan happen? Does it happen every time we issue a query? Do the indexes help? How?
- What format is a prepared statement saved in?
- What extra features can we add to our DB, if any?
Well, these are some of the questions I aim to answer along the way. And for that I will be relying heavily on the SQLite Architecture Documentation (https://www.sqlite.org/arch.html) and also here (https://www.sqlite.org/zipvfs/doc/trunk/www/howitworks.wiki).
View on Github (pull requests are welcome)
And hey, I would be lying if I said I got the idea out of the blue, no I didn't. I got the inspiration from this other great developer called Connor, that basically did the same thing, but in C, right here (https://cstack.github.io/db_tutorial/), if you wanna check it out!
If you wanna follow this track don't forget to follow me here on Dev.to and also give some love!
Cheers!
Top comments (0)