← All work 02 · Personal project · Systems engineering

Mînî — a database engine, from scratch.

~52,000 lines of C++ implementing a real relational database: slotted-page storage, ACID transactions with MVCC, a cost-based query optimizer, vectorized + parallel execution, ARIES crash recovery with point-in-time restore, and a TLS SQL wire protocol. Not a toy — a rigorously tested engine.

Role
Directed the build with AI
Stack
C++17 · AVX2/NEON · kqueue/epoll
Scope
Phases 1–25 · 52k LOC
Quality
110/110 tests · ASan+UBSan+TSan
0
Lines of C++
0/110
Test binaries green
0
Index types
<0
Residual risk /10
How I built this

A 52,000-line database engine is not something I sat down and typed. I directed AI agents across 25 build phases — driving the architecture, calling the trade-offs, and reviewing the output through a rigorous test suite (110/110 green, fuzzing, sanitizers). This is the clearest proof of the point: with AI as the tool and the judgment to steer it, one curious person can ship something that used to take a team.

Interactive · demo

Run SQL. Watch the optimizer think.

Pick a query and the engine parses it, considers access paths, and builds a physical plan — choosing an index scan over a seq scan, reordering joins by cost, pushing predicates down. This is a faithful sketch of Mînî's real planner behavior.

mini> cost-based query planner ○ demo mode
cost: — rows: —

The optimizer picks plans by estimated cost from real table statistics — an index scan when selectivity is high, a hash join when tables are large, a decorrelated subquery when it can prove equivalence.

What's inside

Every layer of a real database.

Storage

  • Slotted pages
  • LRU-K buffer pool
  • WAL + ARIES recovery
  • Point-in-time restore
  • Hybrid PAX columns

Indexing

  • B+ Tree
  • Extendible Hash
  • R-Tree (spatial)
  • Graph (CSR)
  • Cost-driven selection

Execution

  • Vectorized (SIMD)
  • AVX2 + NEON
  • Parallel exchange ops
  • Hash / sort-merge joins
  • Window functions

Transactions

  • MVCC snapshot isolation
  • 2PL fallback (4 levels)
  • Deadlock detection
  • TLS 1.2+ wire protocol
  • GRANT / REVOKE auth
Engineering rigor

Tested like it matters.

  • Crash matrix + IO fault injection
  • WAL / parser / wire-protocol fuzzers
  • Property tests + join-reorder oracles
  • SQL-injection corpus + security audit (<3.0/10 residual)
  • ASan + UBSan on every binary; clean TSan sweep
Why it matters

Depth behind the AI.

Building a database from the page layer up is the clearest proof that the AI work above it rests on real systems fundamentals — concurrency, memory, storage, recovery, and query planning. The same discipline that keeps a transaction ACID keeps an agent's answer grounded.

See that discipline in Îktomnî →
← All work