duckdb-differential
An experimental C++ extension for stock DuckDB 2.0 that adds versioning to ordinary
DuckDB databases: snapshots, time travel, branches, clones, restore and S3 export. Native
catalogs, SQL, transactions, indexes and compression run unchanged over a durable
differential filesystem that shares unchanged data between all versions. The SQL surface
follows DuckLake's conventions.
INSTALL differential FROM community;
LOAD differential;
ATTACH 'differential:sales' AS sales; -- created on first use
CREATE TABLE sales.t AS SELECT 42 AS value;
CALL differential_create_snapshot('sales', name => 'baseline', message => 'initial load');
UPDATE sales.t SET value = 99;
ATTACH 'differential:sales' AS old (SNAPSHOT_NAME 'baseline');
SELECT value FROM old.t; -- 42
SELECT value FROM sales.t AT (VERSION => 1); -- 42, DuckLake-style time travel
FROM sales.snapshots();
Status: experimental Build from source and load the local artifact
(development); community installation commands describe the planned release.
Full v1 acceptance is not complete. Only macOS arm64 and a MinIO S3
endpoint are fully tested; real AWS was exercised manually (exports, reads, branch heads), and
other platforms are untested.
Documentation
| Guide | Covers |
|---|
| Lifecycle guide | One database from creation to cleanup, S3 export included, with runnable SQL |
| Shared databases | Several hosts writing one database through S3: joining, publishing, conflicts and recovery strategies, failure playbook |
| SQL reference | Every statement, ATTACH option, setting and function: parameters, defaults, result columns and an example each |
| SQL API | Semantics and rules: ATTACH, time travel, S3 profile, caching, secrets, shared databases, limits and errors |
| Branch merging | Local and single-writer S3 merges into new or detached existing targets: typed three-way conflicts, preflight and guards, schema and view changes, ancestry and durable recovery |
| Merge validation | Deployment pilots, exact result verification and bounded resource/recovery checks |
| Deployment | Processes, users and hosts; local storage vs S3; branch heads |
| Concurrency and multitenancy | What runs concurrently, guarded heads, shared databases, tenant isolation |
| Durability and recovery | The durable write path and the evidence for crash recovery |
| Storage formats | Repository layout, metadata schema, hashes, segments, S3 layout and formats |
| Architecture | How the extension sits below DuckDB's native storage |
| Security · Contributing | Credentials, data access and diagnostics; development, testing and publication boundaries |
| Compatibility · Performance and sizing | Supported DuckDB build, dependencies and platforms; performance and sizing |
| Changelog · License · Third-party notices | |
Contents
Installation
differential targets DuckDB 2.0 and is prepared for community publication. Until it is
published, build and load it locally. The planned community installation is:
INSTALL differential FROM community;
LOAD differential;
INSTALL is needed once per DuckDB installation; LOAD is needed in every session before
the first ATTACH 'differential:…' or SET differential_*. The extension bundles its own
SQLite and AWS SDK. For S3 it uses DuckDB's TYPE s3 secrets, or your usual AWS credentials
(environment, ~/.aws, instance roles) when no secret matches (S3 and secrets).
To update, run UPDATE EXTENSIONS (differential);.
SQL capabilities
The full reference is docs/api.md.
Settings