arXiv:2609.02106cs.DBSep 2026

Manuscript Offprint

arXiv:2609.02106

Git4Data: Database-Native Version Control for AI Agents

Hongshen Gou, Zuyu Zhang, Yuze Sun, Peng Xu, Feng Tian, Long Wang, Jianguo Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Large Language Model (LLM) agents increasingly explore many candidate states of relational data in parallel, each of which should remain isolated, reproducible, and auditable, preferably through the same SQL interface used for ordinary data work. Existing tools support this requirement only partially: source-code version control does not scale to large datasets, whereas relational databases manage large data efficiently but rarely expose native branching, comparison, and merging. We present Git4Data, a database-native version-control layer for agentic workflows. Git4Data treats a database as a repository and a table as a versioned object, exposing Git-style operations (snapshot/tag, branch, diff, and merge with explicit conflict-resolution policies) through SQL extensions. Implemented in MatrixOne, a cloud-native relational database, Git4Data leverages immutable object storage and MVCC to make the cost of these operations proportional to the size of the change rather than the size of the data. On the BranchBench agentic branching workloads, Git4Data outperforms DoltDB by up to an order of magnitude. Overall, we believe this work sheds light on how relational databases can better support AI agents through efficient versioning.

1 INTRODUCTION

Large Language Model (LLM) agents are beginning to act as data engineers [6]: they read relational data, propose transformations [12], evaluate SQL [9], and iterate. Unlike a human engineer working on one snapshot at a time, a fleet of agents explores many candidate states in parallel [1, 10], and each agent must be isolated, reproducible, and auditable. An agent must fork data before speculative updates, inspect row-level diffs, merge only validated changes, and roll back failed paths without copying the base version. In other words, agentic workflows require data-version primitives as first-class, database-native operations rather than as external tools.

Consider agentic data repair workflow in Figure 1. A raw snapshot S0S_0 contains duplicate entities, malformed fields, and inconsistent records. Rather than committing to one cleaning strategy up front, an agent branches S0S_0 and applies a different SQL repair to each candidate: categorical normalization, fuzzy entity deduplication, and context-dependent semantic fixes. Each evaluates the candidates with SQL queries and proxy quality signals, prunes poor branches, and compares promising ones through diffs. Because each strategy repairs a different subset of the records, no branch wins outright, and the goal is to selectively merge accepted row-level deltas into a repaired state SrS_r while preserving an audit trail of what was tried, accepted, and rejected.

Software engineering already has mature support for these primitives, with Git [3] as the de facto standard. However, data engineers do not have a comparable foundation. Applying a source-code version control system (VCS) to large datasets is prohibitively slow,

Figure

Figure 1: Agentic data repair workflow with Git4Data

because its diff and merge tools load and compare the entire dataset in memory, and it does not scale to billions of records stored in cloud object stores.

Relational databases mutate data efficiently via transactions, but do not provide explicit version control. Multi-Version Concurrency Control (MVCC) retains row versions in a linear history, but does not allow tracing back at a specific version, let alone doing so at agent swarm scale. Database snapshots and Point-In-Time Recovery (PITR) capture named past versions, yet support only read and restore at a single timeline, but cannot hold two writable lines of work. Writable clones of tables or databases in Snowflake [4] and Supabase [21] allow development and testing in parallel, and Neon [13] forks an entire Postgres instance at any point in its history through storage-level copy-on-write. But none of these systems can report the row-level differences between two branches, whether both branches modify the same rows, or merge validated changes into a new version. In other words, what is missing in databases is not the ability to capture or fork data changes, but the SQL-level operations to manipulate the resulting versions: comparison and conflict-aware reintegration.

We propose Git4Data, a new abstraction that supplies exactly this missing layer. Git4Data treats a database as a repository and a table as a versioned object. By extending snapshot/tag, branch, row-level diff, and merge as SQL statements (Section 2), an engineer or an LLM agent could version data through the interface already used for data work, and changes spanning multiple tables publish in one transaction. Merge is three-way and conflict-aware rather than last-writer-win. Conflict resolution is currently at the row granularity, and richer semantic resolution is one of the research problems this abstraction opens (Section 6).

We then implement an initial version of Git4Data in MatrixOne [11], a cloud-native relational database. Our key observation is that a modern OLTP database already provides the mechanisms for the concept, where data resides in immutable, append-only objects governed by MVCC. A table version is just a lightweight metadata, and two versions differ only in the objects written since they diverged, letting diff and merge read only those deltas. The initial results are encouraging: cloning a 100 GB table takes 0.2 s and a few hundred kilobytes of metadata; diff and merge outperform their SQL equivalents by orders of magnitude. On BranchBench [1] agentic branching workloads Git4Data runs up to an order of magnitude faster than DoltDB [5] while sustaining 1,000 concurrently branching agents.

This paper makes the following contributions:

  • We propose Git4Data, a database-native version-control abstraction that exposes branch, diff, and merge as SQL extensions, applicable to any OLTP database (Section 2).
  • We implement a Git4Data prototype in MatrixOne 1^{1}, where metadata-only cloning and delta-based diff and merge keep the cost proportional to the changes (Section 3).
  • We evaluate the prototype on BranchBench, observing up to an order of magnitude speedup over DoltDB at 1,000 concurrent agents (Section 4).
  • We distill the lessons of building Git4Data and identify the open problems that we believe start a new line of research on in-database version control (Section 6).