Database Kernel (5): Transactions, Timestamps and GC

Multiple versions make concurrent reads and writes possible, but versions aren’t free: who creates them, who can see them, and when they can be dropped all need explicit answers. Part five of the plan series. 1. TxnMgr holds very little TxnMgr{ currentStartTs uint64 // starts at 2, +1 per txn, < 2^62 currentTxnId uint64 // starts at 2^62, +1 per txn lowestActiveId uint64 lowestActiveStart uint64 activeTxns []Txn // created, not committed/rolled back committedTxns []Txn // committed, not GC'd oldTxns []Txn // GC-able, not GC'd } The two counters start in different ranges so timestamps and transaction ids never collide: ...

October 22, 2026 · 2 min · daviszhen

Implementing Git for Data on DuckDB (Part 2): Pinning History — Snapshots, Retention Watermarks and AT SNAPSHOT

The previous post argued that the counterintuitive gate is retention. This one takes it apart: two watermarks, one measurement, and making AT (SNAPSHOT => 'name') actually read. 1. Two watermarks DuckDB’s MVCC only answers “can this transaction see that row.” Supporting snapshots means separating two questions: Watermark Computed from Used for LowestVisibilityBound() Active transactions only Deciding which commits are “past”: releasing locks, cleaning transaction records LowestRetentionBound() min(active transactions, pinned snapshots) Deciding which historical versions must not be reclaimed We initially only had the first. The result: create a snapshot, run a checkpoint, and the old version is reclaimed anyway — because to checkpoint, there are no active transactions, so the old version is garbage. ...

October 20, 2026 · 3 min · daviszhen

Implementing Git for Data on DuckDB (Part 1): Feasibility — Why an Analytical Database Can Grow Version Control

Git gave code cheap rollbacks, parallel branches and merges. Data never got the same deal — because data is huge; one copy is a terabyte. But a trend is changing that: the people editing data are turning into AI clusters. Once scale and frequency go up an order of magnitude, branching, rollback and merge move from “nice feature” to “the only way this can be safe.” That’s the starting point of Git4Data. MatrixOne has already built these primitives into a database. My question: can DuckDB do the same? ...

October 20, 2026 · 3 min · daviszhen