query.sql
loading wasm…

My toy relational database, built from scratch in Zig — no dependencies, no prior database experience. I’m learning in public. The goal is a modular architecture where each layer is independently swappable. Early, unstable, and changing fast.

// deps 0
// lang zig
## 02 ─ internal/layers ─────────────────

Each layer is independently swappable — plug in a different buffer pool, storage backend, or transaction strategy without touching the rest. This is also my live progress log: what’s built, what’s planned, and what I’m still working out.

──Dialect + Parser
MySQL Dialect
mostly compatible
○○○○○planned
PostgreSQL Dialect
partial support
○○○○○planned
SQLite Dialect
basic support
○○○○○planned
──Planner
Rule-Based Planner
heuristic rewrites
○○○○
Cost-Based Optimizer
statistics-driven
○○○○○planned
──Transaction
Single-Writer
serializable isolation
●●○○○
MVCC
snapshot reads
○○○○○planned
──Buffer Pool
LRU
least-recently-used eviction
●●●●
Clock
approximate LRU, lower overhead
○○○○○planned
ARC
adaptive replacement cache
○○○○○planned
──Write-Ahead Log
WAL Manager
crash-safe commit records
●●○○○
──Storage Backend
Local File
.db file on disk
●●●○○
Remote / S3
object storage backend
○○○○○planned
In-Memory
ephemeral, no persistence
●●○○○
// testing

Correctness matters too

Toy project, yes — but sloppy results aren't the goal. The aim is a well-tested implementation with growing coverage across SQL correctness, durability, and concurrency.

active

sqllogictest

The SQLite project's standard test corpus — thousands of query-and-result assertions covering a wide surface of SQL. The clearest measure of how much standard SQL PagerDB actually gets right.

coverage 97.75%
passed cases
5,547,356
tracked files
622
work in progress

deterministic simulation

Repeatable crash-and-recovery scenarios to verify pager, WAL, and transaction behavior under controlled fault injection.

status

not published yet

work in progress

fuzzer

Random SQL generation and state mutation to surface parser, planner, and execution engine edge cases.

status

not published yet

## 06 ─ frequently asked ───────────────────────────────────────────

Questions no one asked, but I'm answering anyway.

Q.01 is this production-ready?

No. Not even close. It's not mature enough to be considered a toy database, let alone a production one. If you're asking this seriously, I'm concerned.

Q.05 why zig?

I just wanted to learn Zig. No grand vision, no benchmark slides. Just vibes.

Q.03 how do i contribute?

I'm not accepting contributions right now — that would defeat the whole point of a learning project.

Q.04 do you use AI?

Yes, a lot — but I try not to let it just write everything for me. I slow down, read the output, understand it, and rewrite it myself when I can. Muscle memory in Zig won't build itself.