cockroachdb / cockroachdb/cockroach

Feature Request: Native Database Branching (Git-like, Copy-on-Write Snapshots)

Open
#155,337 6 comments 2 reactions 1 assignee Claimed by @dt View on GitHub
A-disaster-recovery C-enhancement O-community T-disaster-recovery X-blathers-triaged
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Description:**
I would like to request the implementation of a native **database branching feature** in CockroachDB, similar to Neon’s branching model ([Neon Branching Docs](https://neon.com/docs/introduction/branching)). The feature would allow users to:

- Create lightweight branches (snapshots) of a database at a given point in time.
- Work on these branches independently without affecting the main database.
- Merge changes back into the main database or other branches.

**Motivation:**
This feature would greatly enhance development workflows, enabling:

- Safe experimentation on production-like data.
- Git-like workflows for databases, useful for testing, staging, and feature development.
- Easier collaboration between developers with isolated database states.

Currently, while CockroachDB provides **MVCC** and **AS OF SYSTEM TIME**, these mechanisms allow only historical access and require manual backup/restore workflows to simulate branching. A native implementation would simplify these workflows and bring CockroachDB closer to modern developer expectations for branching/versioning in databases.

**Suggested Features / Requirements:**

1. Lightweight, copy-on-write branches that do not duplicate the entire database unnecessarily.
2. Ability to merge branches with conflict resolution support.
3. Optionally, integration with `AS OF SYSTEM TIME` to reference historical states when creating branches.
4. Support for branch lifecycle management (create, delete, list, merge).

**Use Cases:**

- Development and testing of features on real production data without risking the main database.
- Creating staging environments quickly for QA or performance testing.
- Versioned experimentation, rollback, and collaborative workflows.

**References:**

- Neon Database Branching: https://neon.com/docs/introduction/branching

I believe this feature would be a valuable addition to CockroachDB and greatly improve developer productivity and operational flexibility.

Jira issue: CRDB-55387

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.