← Isaac Ishimwe

Database engine · built from scratch

ArcaDB.A database you can watch think.

ArcaDB (arca is Latin for a strongbox, the chest where valuables are kept safe) is a relational database I wrote from nothing: a SQL parser, a query planner that chooses between index lookups, range scans, hash joins and nested loops, B-tree storage with real splits and merges, transactions, and a write-ahead log that survives crashes. It runs entirely in your browser. Every query shows you exactly what it did.

0dependencies
3join algorithms
17test suites
16kfuzzed B-tree operations
WALcrash-safe, persists on refresh

Query editorautocommit
Results

Under the hood

Every layer,
written by hand.

TokenizerTurns text into keywords, names, numbers and strings.
→
ParserRecursive descent with operator precedence builds an AST.
→
PlannerPushes filters down, picks an access path and a join algorithm.
→
ExecutorJoin, filter, aggregate, sort, project, limit. Counts rows and pages.
→
StorageB-trees for tables and indexes. Every change goes to the WAL first.

01B-tree storage

Each table is a B-tree keyed on its primary key. Full nodes split and push their middle key up. Underfull nodes borrow from a sibling or merge with it, so the tree always stays balanced and every lookup costs O(log n).

02Secondary indexes

CREATE INDEX builds another B-tree keyed on (value, primary key), so duplicate values are fine. Lookups use the index, then fetch each row by key: the same “bookmark lookup” real databases do.

03Query planner

WHERE conditions are split on AND and pushed down to the table they mention. Equality on an indexed column beats a range, which beats a full scan. Joins on an indexed column use an index nested-loop join; other equi-joins get a hash join.

04Transactions

BEGIN, COMMIT, ROLLBACK. Every change is logged with a before-image, so rollback replays the log backwards. A failed statement undoes its own partial work, so a bad multi-row INSERT leaves nothing behind.

05Write-ahead log + recovery

Changes reach the log before they count as committed. On startup the engine loads the last checkpoint and replays only committed transactions. Hit “Simulate crash” in the middle of a transaction and watch the uncommitted work vanish.

06Tested hard

The B-tree is fuzzed with 16,000 random inserts and deletes against a reference model, and its invariants are checked throughout: key order, node fill, equal leaf depth. SQL, joins, aggregates, transactions and recovery all have tests.