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?

1. Start with what DuckDB already has

DuckDB is not a blank slate. It already has the three foundations of MVCC:

CapabilityDuckDB’s implementation
Transaction visibilityTransactionData(transaction_t, VisibilityBound), Sees(ts) = ts < visibility_bound || ts == transaction_id
Versioned storageEach row group’s ChunkVectorInfo records insert/delete commit ids
Commit numberingCommit ids are issued from current_start_timestamp++

In other words, every row group in DuckDB already carries “when was this row inserted, when was it deleted.” That’s the skeleton of a time machine.

2. What’s missing: three pieces

GapWhy it mattersImplementation
RetentionToday, checkpoint reclaims old row groups — history isn’t “unreadable”, it’s “deleted”Pin a watermark so GC/checkpoint can’t cross it
RegistrySomething must remember “snapshot snap_01 is pinned at commit id N”, across processes and crashesPersist references (snapshots/branches)
Read at pinA syntax and execution path that reads a table at a pin instead of “latest”AT (SNAPSHOT => 'name') + a scan over a synthetic TransactionData

Of the three, the counterintuitive one is retention. Most people think “versioning” means “I can read old versions.” The real gate is whether the old version still exists. DuckDB reclaims row groups that are no longer visible at checkpoint (measured: after checkpoint, a 1M-row table’s old version simply disappears). So Git4Data’s first-order problem is retention, not query syntax.

3. Feasibility verdict

Feasible — and less work than expected, because DuckDB’s MVCC already stores each row’s history. The three things to build:

  1. Two watermarks: LowestVisibilityBound() (active transactions only) for releasing locks and cleanup, and LowestRetentionBound() (active + pinned snapshots) for retention;
  2. Persist the pins: commit ids are not durable across processes; they must be written with the references, or after restart a pin points at a past that no longer exists;
  3. One historical read path: grammar + binding + a table function that scans at a given bound.

The next three posts cover these: snapshots and retention, the branch primitives, and the engineering of moving the registry into tables.

Get the next essay

New essays on products, business and tech — plus what the experiment's numbers actually say.