This Project follows the excellent guide by cstack on creating a sqlite-esque db. Writing a DB is a crazy hard thing to do if you are trying to build a feature complete DB it will require millions of lines of code which is out of scope for me at least.

My primary goal with this project is to learn how Databases work on a practical level having read the theory of it. Therefore we will try to mock SQLite as its bit more simpler to the older databases like Postgres and MySQL.

So we can split the Database into two major parts, First is the frontend that will read a query , tokenize it, parse it and generate instructions based on it.

The backend will consist of the virtual machine, B-Tree, pager and os interface.

The virtual machine takes instructions from the frontend. It can then perform them on tables or indexes stored in a BTree. The VM is basically a big Switch statement on the instructions.

The Pager recieves commands to read or write pages of data. It is responsible for reading / writing at appropriate offsets in the database file. It also keeps a cache of recently accessed memory, and determines when those pages need tow be written back.

The OS interface layer differs depending on which platform sqlite was compiled for.

The first step for us would be to make an REPL.

Here are the next steps

Getting Started

Basic Table

Tests & Validation

Persistance

Adding a Cursor

The B step