Configs2026年4月15日·1 分钟阅读

Dolt — The SQL Database You Can Fork, Clone, Branch and Merge

The world's first version-controlled SQL database. Dolt combines MySQL compatibility with Git-style branching, diffing and merging so schemas and data can be reviewed and pull-requested.

Introduction

Dolt is an open-source SQL database that stores its tables, schemas and commit history in a Merkle DAG, so every operation you expect from Git — clone, branch, diff, merge, log, blame, push, pull — works on live data. It speaks the MySQL wire protocol, so existing drivers, ORMs and BI tools connect unchanged.

What Dolt Does

  • Serves SQL over the MySQL protocol with a large subset of MySQL 8 syntax.
  • Versions both schema and rows: every dolt commit is content-addressed.
  • Produces row-level diffs between branches or commits with dolt diff or dolt_diff_<table>.
  • Merges branches, detecting schema and data conflicts that you can resolve in SQL.
  • Pushes and pulls repositories to DoltHub or any S3-compatible remote.

Architecture Overview

Under the hood Dolt stores data in Prolly Trees — B-tree-like structures with content-addressed chunks that make cheap structural sharing possible across branches. A commit references a root hash covering every table, so diffing two commits is an O(changes) tree walk. The SQL layer is a query engine that reads and writes Prolly Trees transactionally and speaks the MySQL protocol.

Self-Hosting & Configuration

  • Install the single Go binary; no external dependencies.
  • Run dolt sql-server to expose the MySQL protocol on port 3306 for BI tools and drivers.
  • Configure users and grants with standard CREATE USER / GRANT statements.
  • Back up by cloning the repo to S3/GCS using dolt remote add + dolt push.
  • Use doltgres when you need the PostgreSQL wire protocol instead.

Key Features

  • Time-travel queries: SELECT * FROM items AS OF 'HEAD~3';.
  • Dolt functions: dolt_commit(), dolt_merge(), dolt_branch() callable from SQL.
  • dolt_history_<table> and dolt_diff_<table> system tables for auditing.
  • CI integration via dolt ci to test data changes the way you test code.
  • Free public hosting for open datasets on DoltHub.

Comparison with Similar Tools

  • Git LFS / DVC — version files, not live SQL tables.
  • TerminusDB — graph-oriented, not MySQL-compatible.
  • LakeFS — Git semantics on object storage, but no SQL engine.
  • Liquibase / Flyway — version schema migrations only, not data.
  • Postgres + temporal tables — auditing but no branching or merging.

FAQ

Q: Is Dolt a drop-in replacement for MySQL? A: For most CRUD workloads, yes. Some replication and niche engine features are not implemented. Q: How big can a Dolt database get? A: Multi-hundred-GB repos are in production; performance scales with Prolly Tree chunking. Q: Can I branch terabytes without copying? A: Yes — branches share chunks, so they are metadata operations. Q: Is Dolt good for OLAP? A: It is tuned for OLTP-ish data with versioning. For heavy analytics, export to DuckDB or ClickHouse.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产