In a three-node test cluster, db-branch can create a PostgreSQL database branch in approximately 0.5 seconds and a MySQL branch in about 3 seconds. These operations involve 0 bytes of data copying because the system leverages ZFS copy-on-write (CoW) technology to create clones of a base dataset.

This GIF demonstrates the core functionality of db-branch, including branch creation and lifecycle management.
Mechanism of Copy-on-Write Branching
The core architecture of db-branch relies on ZFS datasets. A 'base' is a ZFS dataset containing a loaded database, while a 'branch' is a ZFS clone of a snapshot of that base. Because ZFS clones are copy-on-write, the initial creation of a branch is nearly instantaneous regardless of the database size.

The branch graph visually represents how clones are derived from base datasets using ZFS copy-on-write technology.
Each branch runs its own database server on a unique port. To simplify application access, the system can use ProxySQL routing to direct client connections to the correct branch based on user names or specific query comments.

The web console provides a unified interface for managing the various database branches created by the system.
“db-branch creates a copy-on-write branch of a large database in seconds, with nothing copied.”
— GitHub - db-branch/db-branch: Instant MySQL database branches on ZFS clones, clustered across VMs with ProxySQL routing
Use Cases for AI Agents and CI/CD
db-branch is specifically designed to solve the problem of 'shared' database environments in development. It allows for 'per-pull-request' database copies, where each CI run gets a fresh, isolated copy that is automatically deleted after a set time-to-live (TTL).
For AI agents, the project includes a built-in MCP (Model Context Protocol) server. This enables an LLM agent to autonomously create a branch, execute risky queries or migrations, and then delete the branch, ensuring that production data remains untouched during the agent's operations.
Version Management and Cluster Architecture
The system supports running multiple versions of MySQL and PostgreSQL simultaneously. Users can perform a 'check-only' upgrade on a specific branch to identify potential issues before applying the upgrade to the base or other branches.
Chart drawn by HN Digest from figures reported by github.com; values are shown as written in the source.
The software operates as a Raft cluster of virtual machines, which shares bases, branches, and settings across nodes. While the core project is licensed under Apache-2.0, certain advanced features like SSO, auditing, and history are offered as separate, closed-source modules.
Deployment Requirements and Limitations
db-branch is a self-hosted solution and does not offer a managed cloud version. It requires a Linux environment (specifically Ubuntu 24.04 or 26.04 LTS) and a ZFS pool to function.
Because the system relies on ZFS-specific features, it is not compatible with standard cloud-native storage volumes that do not support ZFS cloning. Additionally, while the core is open-source, the project uses a mix of open and closed-source modules for specific enterprise features.
What Hacker News readers are saying
- Experience: One commenter shared their practical experience of recently setting up a similar system at their workplace to provide cheap database clones. comment ↗
- Technical note: A commenter asked for clarification on whether the project utilizes the native file_copy_method in Postgres 18 or uses a custom implementation. comment ↗
- Open question: One user raised an important question regarding whether it is possible to merge changes from a created branch back into the official copy. comment ↗
Summarized opinions from the Hacker News thread, not verified facts. Read the full discussion ↗