



Built a DBMS from scratch in C to study buffer pool behavior on real SQL workloads
I’m a third-year CS student and over the past year I’ve been building minidbms — a database engine written from scratch in C and Python — to study buffer pool replacement policies experimentally.
Current features:
- slotted-page heap storage
- direct pread/pwrite I/O
- LRU / Clock / NoCache / OPT
- trace-based telemetry replay
- benchmark + sweep analysis tools
- interactive cache inspector
- B+ tree indexes (in progress)
Some interesting results so far:
- Bélády-related behavior reproduced empirically:
at small pool sizes (3–8 frames), NoCache can outperform LRU.
- LRU stack property verified:
hit rate never decreases as memory increases.
- Working-set convergence:
at 32 frames all policies converge to the same hit rate with zero evictions.
The Cache Inspector (last image) replays every page access step-by-step and shows the full buffer pool state after each event.
Next step:
empirical comparison of shared vs segregated buffer pools for index and data pages.
github.com/rsomavi/minidbms