Abstract
ElVoidDB is a lightweight C++17 database engine designed for educational use and simple keyβvalue workloads. It shows the basic parts of a database: storage, buffer pool, concurrency, and SQL parsing.
Why I Built This
This database is mainly inspired by my CSE 562 Database Systems class and by TacoDB. My goal is to build a real working database from scratch. I built it step by step as I learned the class concepts and saw how TacoDB is structured.
Project Goal
- Teach database internals with a real example
- Support basic SQL: SELECT, INSERT, UPDATE, DELETE
- Use a slotted-page design with 4 KB pages
- Implement an LRU buffer pool and async I/O
Architecture
The system has these layers:
- Parser & Planner β turns SQL text into an AST
- Execution Engine β runs commands from the AST
- Storage Manager β reads/writes 4 KB pages
- Buffer Pool β caches pages and flushes them in the background
- Concurrency & Logging β simple async I/O threads
Folder Structure
ElVoidDB/
ββ include/
β ββ Exceptions.hpp
β ββ Page.hpp
β ββ Storage.hpp
β ββ BufferPool.hpp
β ββ ThreadPool.hpp
β ββ BackgroundFlush.hpp
β ββ Parser.hpp
β ββ Commands.hpp
ββ src/
ββ main.cpp
ββ Exceptions.cpp
ββ Page.cpp
ββ Storage.cpp
ββ BufferPool.cpp
ββ ThreadPool.cpp
ββ BackgroundFlush.cpp
ββ Parser.cpp
ββ Commands.cpp
Build & Run (Raspberry Pi 5, 8 GB)
| Step | Command |
|---|---|
| Create build dir | mkdir build && cd build |
| Configure | cmake .. |
| Compile | cmake --build . -j4 |
| Run CLI | ./elvoiddb |
API Reference
Storage::readPage(page_id)β loads a page from diskBufferPool::fetchPage(page_id)β gets a page with LRU policyParser::parse(sql)β creates an AST from SQLCommand::execute()β runs a SQL command
Performance Metrics
On a Raspberry Pi 5 (8 GB RAM, NVMe):
- INSERT: ~600 ops/sec
- SELECT: ~900 ops/sec
Roadmap
- Crash recovery with write-ahead log
- Indexing (B+-trees)
- Joins & predicate filtering
- Query optimizer features
- Unit tests & CI setup