PITR and Clone: Point-in-Time Recovery and Zero-Copy

Beyond “read a snapshot”, a data version system has two very practical abilities: point-in-time recovery (PITR) and zero-copy clone. This post covers the trade-offs in implementing them. 1. PITR: find the newest reference not later than T A reference (snapshot or branch) is essentially “a name plus a commit id (pin)”. PITR needs no extra log; it does: given time T: find references with created <= T take the one with the largest created restore to it That is recovery based on the reference sequence, not WAL replay. The upside is simplicity and consistency with the snapshot system; the downside is precision tied to how often you create references — if two references are an hour apart, you can only restore to before that hour. ...

October 20, 2026 · 3 min · daviszhen

Data Version Control: Why a Database Needs Git

Git gave code cheap branching, rollback and merge. 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. When the scale and frequency of writes go up an order of magnitude, branch / merge / rollback move from “nice feature” to “the only way this can be safe”. 1. What data versioning needs Strip the product narrative and a data version system needs at least three things: ...

October 20, 2026 · 3 min · daviszhen

Implementing Git for Data on DuckDB (Part 4): Moving Metadata into Tables — Transactions, Crash Consistency and 'Hidden but Readable'

The first three posts were about features. This one is about the engineering of the metadata itself: where snapshots and branches are stored, and how they survive. 1. The problem: a metadata block is not transactional The first implementation wrote the reference registry (snapshots/branches/pins) into the checkpoint metadata block. It persisted, but had two fatal issues: Not in a transaction: if CREATE SNAPSHOT failed or rolled back, the block might already have been written; No WAL: if the process crashed before the next checkpoint, the change was gone. The actual requirement: reference changes must commit or roll back with the caller’s transaction, like ordinary data, and go through WAL replay. ...

October 20, 2026 · 4 min · daviszhen

Implementing Git for Data on DuckDB (Part 3): Branches, diff, pick, merge — The Version Primitives of Data

The first two posts made history readable. This one covers what makes a data version system actually useful: branches and changes. 1. The branch model A branch isn’t “a copy of the data”; it’s a combination of three things: branch = pin (which commit) + name + lineage (parent / base_line) + optional storage (materialized copy) or delta (changes relative to a base) materialize: really copy the table; reads go straight to the copy; delta: store only “which keys were removed from the base, which rows were added”; reads compose; update in a delta is a removal plus an addition of the same key (replacement pairing). This design brings the cost of “create a branch” from “copy a table” down to “register one metadata row.” ...

October 20, 2026 · 4 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