Branching a terabyte-scale database in under two seconds, at zero disk cost, with no cloud vendor in the loop — that’s the pitch from db-branch, an Apache-2.0 tool that surfaced on Hacker News today. It applies ZFS copy-on-write clones to MySQL and PostgreSQL to give every developer, CI pipeline, and AI coding agent an isolated, full-data database environment that spins up in seconds and disappears when done.
The Problem With Shared Staging #
If you’ve worked on a team with ten engineers and ten simultaneous feature branches, you know the pain. Everyone fights over one staging database. Schema migrations get tested against stale dumps. The devs doing destructive data work slow everyone else down. And if you’re running AI coding agents that mutate data autonomously, a shared database is a liability waiting to happen — one DROP TABLE away from a bad afternoon.
The current workarounds — manual pg_dump pipelines, spinning up separate provisioned RDS instances per branch, or just yolo-ing it on shared staging — are all either slow, expensive, or unreliable. Database branching has been a cloud-first story until now. Tools like Neon (Postgres, cloud-only), PlanetScale (MySQL, schema changes only), and Databricks Lakebase (enterprise analytics) all require you to live in their ecosystem. db-branch doesn’t.
How It Works #
db-branch mounts your MySQL or PostgreSQL data directory on a ZFS dataset. When you create a branch, it takes a ZFS snapshot of a cleanly shut-down instance and clones it — a copy-on-write operation that takes the same time regardless of whether the dataset is 1GB or 1TB. A separate database process starts on the clone on a new port, routed through ProxySQL. The connection string you get back is standard JDBC or DSN — nothing about your application code changes.
db-branch create --source prod --ttl 24h myfeature
db-branch connection-string myfeature
db-branch checkpoint myfeature pre-migration
db-branch restore myfeature pre-migration
db-branch destroy myfeature
The checkpoint and restore commands are what elevate this beyond a simple clone script. You can run a migration, verify it, roll back if something looks wrong, and iterate — all without reprovisioning the branch from scratch.
The AI Agent Use Case #
The killer use case in 2026 isn’t developer sandboxes — it’s AI agents. When a coding agent has permission to run SQL migrations autonomously, you need every agent run isolated at the database layer, not just the filesystem. db-branch’s TTL-based branches give each agent its own throwaway database environment: when the run completes or the agent goes rogue, you destroy the ZFS clone. Nothing touches production. Nothing touches sibling branches. Databricks calls this the “agentic SDLC” — it’s becoming a recognized category, and db-branch is the first self-hosted tool to target it seriously.
Self-Hosted Is the Point #
The conventional advice is to reach for Neon or PlanetScale for database branching. That advice assumes you can. For teams with data residency requirements, air-gapped infrastructure, high-volume branch churn that would rack up cloud costs, or a preference for owning their stack — the cloud options don’t apply. db-branch ships production-grade clustering (Raft consensus + ZFS send/recv replication) as a single Go binary with an embedded React web console.
The HN community response was telling: several commenters mentioned they’d already built bash scripts to do roughly the same thing with ZFS snapshots and called db-branch what those scripts always wanted to evolve into. The ZFS approach works — DBLab validated it years ago. db-branch just packages it properly, adding Raft clustering and a real CLI on top.
Getting Started #
Prerequisites: a ZFS pool, MySQL 8.x or PostgreSQL 15+, and ProxySQL. Install the binary, point it at your ZFS pool, run db-branch init, and your first branch is two commands away. The README covers single-node setup in about ten minutes; Raft clustering for multi-VM teams is documented in the same repo. If your team is still doing pg_dump | pg_restore pipelines for feature branch databases, this is worth half an hour of your time.