Show HN: db-branch – database branches in seconds for AI agents and CI, via ZFS ...

@best

Show HN: db-branch – database branches in seconds for AI agents and CI, via ZFS github.com · 10 points · 3 comments · HN thread

TL;DR db-branch is a self-hosted Apache-2.0 tool that creates copy-on-write database branches for MySQL and PostgreSQL using ZFS clones, so each branch is ready in seconds without copying data. It targets AI agent sandboxes, per-pull-request databases, and version-upgrade checks, and is in Beta. The Hacker News thread is small (3 comments) and mostly technical questions from the author and a commenter about how it relates to Postgres and MVCC.

  • Creates a branch as a ZFS clone of a base snapshot, so nothing is copied at creation; the project reports about 0.5 s for a PostgreSQL branch and about 3 s for MySQL on its own 3-node test cluster.
  • Each branch runs its own database server process on its own port, with ProxySQL optionally routing clients by user name or query comment.
  • Supports checkpoints and restore, branch reset, TTL-based expiry, and per-branch version upgrades with a check-only mode and automatic rollback on failure.
  • Includes a built-in MCP server so LLM agents can create, query and delete their own branches.
  • Core is Apache-2.0; history, audit, SSO and diff are paid closed-source modules with a 30-day trial in the evaluation setup; there is no hosted version.
  • Requires Ubuntu 24.04 or 26.04 with a ZFS pool; Mac and Windows users can try it through a Multipass VM, with a file-backed pool that is not meant for real data.

Discussion The thread is short and technical. The first commenter asks whether db-branch uses Postgres 18's file_copy_method = clone feature or a custom implementation, and another asks whether it hooks into the databases' MVCC. The author then posts a long introduction explaining the motivation (managed branching services like PlanetScale, Neon and Aurora are cloud-bound, and AI agent sandboxing), the architecture (systemd template units, ProxySQL routing, Raft and ZFS send/recv for clusters) and the trade-offs (clean-shutdown snapshots, per-branch memory cost, write-heavy branches consuming disk). The mood is curious and mostly informational, with the author engaging directly with questions and a small note about the commercial model.

  • Interested in the technical approach and how it compares to native database features (some): Commenters want to know whether db-branch reuses Postgres 18's clone-based file copy or builds its own mechanism, and whether it integrates with MVCC. The thread does not yet include an answer to either question beyond the author's architecture post.
  • Motivation: cheap, self-hosted alternative to managed branching for AI agents and CI (some): The author argues managed services are costly and cloud-tied, and that disposable database sandboxes are useful for letting AI agents run destructive SQL safely. This is the author's own framing rather than a broad community view.
  • Memory per branch is the main practical limit (a few): The author notes each branch is a separate DB process, so memory grows with branch count; shared ARC caching mitigates this but dozens of concurrent branches need careful RAM planning.

Links from the comments

#databases #ZFS #selfHosted #MySQL #PostgreSQL #AIAgents