deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

db-branch creates instant copy-on-write MySQL and PostgreSQL branches on ZFS

Open-source tool db-branch creates copy-on-write MySQL and PostgreSQL branches from ZFS clones in seconds, targeting AI agent sandboxes and per-PR databases in CI.

db-branch creates instant copy-on-write MySQL and PostgreSQL branches on ZFS

A new open-source project called db-branch, shown on Hacker News via its GitHub repository, lets teams spin up copy-on-write branches of large MySQL and PostgreSQL databases in seconds, entirely on their own hardware. The core is Apache-2.0 licensed and sits on top of ZFS clones, so creating a branch involves copying no data at all.

What db-branch does

According to the project's README, a branch is ready in seconds regardless of database size: on the maintainers' own three-node test cluster, roughly half a second for PostgreSQL and about three seconds for MySQL, with zero bytes copied at creation time. Beyond creation, branches can be reset to their original state, deleted automatically once a TTL expires, checkpointed and restored to any saved point, and upgraded to a newer database engine version independently of the base and of sibling branches. A failed upgrade rolls back by itself.

Engine runtimes are installed per version, so several MySQL or PostgreSQL releases can run side by side. Everything is exposed through one shared API surface: a CLI, a REST API, a web console and an MCP server. The tool runs on a single node or as a Raft cluster of VMs that shares bases, branches, settings and users, with optional ProxySQL routing so client applications can keep a single address.

How the ZFS cloning works

The mechanism is filesystem-level. A "base" is a ZFS dataset holding a loaded database, and a branch is a ZFS clone of a base snapshot. Because ZFS clones are copy-on-write, branching is effectively instantaneous and consumes no additional storage until data diverges. Each branch runs its own database server on its own port, and ProxySQL can route incoming connections to the correct branch by user name or by a query comment.

Requirements are Ubuntu 24.04 LTS or 26.04 LTS plus a ZFS pool. For evaluation, the project offers a browser-based console demo that creates nothing real, and a one-command Multipass setup that provisions an Ubuntu VM with a file-backed ZFS pool and a small sample MySQL database in about two minutes.

Built for agents and CI

The README highlights three use cases. First, AI agent sandboxes: the built-in MCP server lets an LLM agent spin up a branch, experiment with a risky query or migration, then throw the branch away, so production data is never touched. Second, a database per pull request: every CI run or PR can work against its own copy of a large database, created in seconds and cleaned up automatically by a TTL. Third, version-upgrade rehearsal: a major upgrade such as MySQL 8.0 to 8.4 can be attempted on one branch first, with a --check-only flag to preview problems before the base is touched.

Editions and licensing

The open-source core covers branches, bases, runtimes, clustering, the CLI, REST API, web console, MCP server, monitoring, notifications, anonymous branches with limits, scheduled base refreshes and cluster-state backup. Additional free modules in the same apt repository cover ProxySQL routing, the greenmask masking tools and anonymisation. A set of closed-source, self-hosted paid modules — authentication and SSO, audit, history, diff, and FSx storage — are enabled with a monthly or yearly license key. There is no hosted or cloud version of the product.

The project describes itself as beta, warning that APIs and command-line details may change before 1.0. English user documentation lives on the project's website, while the design and reference documents are written in Japanese. Contributions require a DCO sign-off, and the project is built from scratch as an independent effort.

Why it matters

Testing against realistic data has long been the expensive part of database work: full copies of large databases cost hours and disk, so teams settle for tiny fixtures or stale snapshots. Filesystem-level copy-on-write makes "a full database per pull request" cheap enough to be routine, and the MCP server targets the newer problem of AI agents running migrations or destructive queries — instead of hoping an agent behaves, you hand it a disposable branch and discard it afterwards. The ZFS requirement confines the tool to Linux servers, a real constraint but a natural fit for CI infrastructure. The open-core split, with clustering and agent support in the free tier and SSO and audit behind a license, follows a familiar sustainability model, and the beta status means early adopters should expect some API churn before 1.0.

  • #open-source
  • #databases
  • #zfs
  • #mysql
  • #postgresql
  • #ai-agents

Related posts