snapshots-and-sharing
Purpose
This document explains how MotherDuck handles database snapshots and sharing, including the underlying Differential Storage architecture that enables efficient versioning and collaboration.
Overview
MotherDuck extends DuckDB with cloud-based snapshot and sharing capabilities, allowing teams to:
- Capture point-in-time database states
- Share read-only snapshots via URLs
- Collaborate without data duplication
- Travel back to any minute-level checkpoint
Core Architecture: Differential Storage
Layered Storage Model
Instead of storing databases as monolithic .duckdb files, MotherDuck uses ordered sequences of “layers”:
Time →[Base Layer] → [Layer 1: +100 rows] → [Layer 2: -5 rows, +50 rows] → [Active Layer] ↓ ↓ ↓ ↓ Snapshot 1 Snapshot 2 Snapshot 3 CurrentKey characteristics:
- Each layer captures only deltas (changes) since the previous checkpoint
- Layers are immutable once created
- Shared data across snapshots is stored only once
Components
-
Snapshot Layer Files (immutable)
- Stored on S3 or object storage
- Each represents a checkpoint in time
- Deduplicated across versions
-
Write-Ahead Log (WAL)
- Tracks individual commits between checkpoints
- Enables granular time-travel beyond checkpoint boundaries
-
Metadata Database (separate OLTP DB)
- Tracks current snapshot state
- Maps layers to storage locations
How Reads Work
When querying data:
- Differential Storage intercepts the read request (FUSE driver layer)
- Splits the read across multiple snapshot layers
- Retrieves data from the newest layer containing each range
- Merges results and returns to DuckDB
This enables zero-copy reads - no data duplication required.
Creating Snapshots
Automatic Snapshots
MotherDuck automatically creates snapshots every minute:
- Skips snapshot if active writes are in progress
- Ensures read-scaling connections stay synchronized
- No configuration required
Manual Snapshots
Force an immediate snapshot:
CREATE SNAPSHOT OF my_database;Behavior:
- Waits for all active writes to complete
- Blocks new writes during snapshot creation
- Creates checkpoint immediately (doesn’t wait for 1-minute timer)
Use cases:
- Before making risky schema changes
- After completing a significant data transformation
- When you need to share the current state immediately
Sharing Databases
Creating Shares
Share a point-in-time snapshot with others:
CREATE SHARE my_share FROM my_database ACCESS UNRESTRICTED -- Who can access VISIBILITY PUBLIC; -- Listing visibility
-- Returns URL: md:_share/my_database/abc123xyzAccess Control Levels
| Level | Description |
|---|---|
ACCESS ORGANIZATION | Only your organization members (default) |
ACCESS UNRESTRICTED | All MotherDuck users |
ACCESS RESTRICTED | Only the share owner initially |
Visibility Options
| Option | Description |
|---|---|
VISIBILITY PUBLIC | Listed publicly to other users |
VISIBILITY HIDDEN | Only accessible via direct URL |
Note: Hidden shares require ACCESS RESTRICTED.
Update Modes
Manual Update (Default):
-- Share stays frozen at creation timeUPDATE SHARE my_share; -- Explicitly publish new snapshotAutomatic Update:
CREATE SHARE my_share FROM my_database UPDATE AUTOMATIC; -- Auto-updates when database changesAttaching Shares
Recipients attach shared databases:
ATTACH 'md:_share/my_database/abc123xyz' AS shared_db;SELECT * FROM shared_db.my_table;Characteristics:
- Read-only access
- Frozen at share creation time (unless
UPDATE AUTOMATIC) - Zero-copy - references same underlying layer files
Complete Workflow Example
Capture and Share a Moment
-- 1. Sync local database to MotherDuckATTACH 'md:recon_v2';COPY FROM DATABASE local_db TO md:recon_v2;
-- 2. Make changes locallyINSERT INTO synthetic_fulfillment_package ...;UPDATE service_charge SET ...;
-- 3. Force immediate snapshotCREATE SNAPSHOT OF recon_v2;
-- 4. Create shareable snapshotCREATE SHARE recon_jan7_ghost_fix FROM recon_v2 ACCESS ORGANIZATION VISIBILITY PUBLIC;-- Returns: md:_share/recon_v2/abc123
-- 5. Share URL with team-- Team members can attach and query:ATTACH 'md:_share/recon_v2/abc123' AS bug_state;SELECT * FROM bug_state.synthetic_fulfillment_package;
-- 6. Continue working - share stays frozenUPDATE service_charge ...; -- Share doesn't see this
-- 7. Optionally update share with new changesUPDATE SHARE recon_jan7_ghost_fix; -- Now share sees latestStorage Efficiency
Comparison with Traditional Snapshots
| Traditional DB Snapshot | MotherDuck Differential Storage |
|---|---|
| Copy entire database file | Only store deltas |
| Snapshot = full copy | Snapshot = metadata pointer |
| 100GB DB = 100GB per snapshot | 100GB DB = ~10MB delta per snapshot |
| Slow (minutes to copy) | Instant (metadata only) |
| Not shareable | URL-based sharing |
Zero-Copy Benefits
- Storage: 100 snapshots ≠ 100× storage cost
- Performance: Instant snapshot creation
- Sharing: Multiple shares reference same layer files
- Cloning: Database forks are zero-copy
Practical Use Cases
Debugging and Collaboration
Scenario: You discover a bug in synthetic data generation.
-- Capture the problematic stateCREATE SNAPSHOT OF recon_db;CREATE SHARE bug_state_so11635787 FROM recon_db;-- Share URL with team for investigationBenefits:
- Team sees exact state that triggered the bug
- You can continue fixing without disrupting their investigation
- No need to export/import large database files
Version Control for Data Pipelines
Scenario: Testing a new matching algorithm.
-- Before: Snapshot baselineCREATE SNAPSHOT OF recon_db;CREATE SHARE baseline_before_algorithm_change FROM recon_db;
-- Run new algorithm-- ... transformation code ...
-- After: Snapshot resultsCREATE SNAPSHOT OF recon_db;CREATE SHARE after_algorithm_change FROM recon_db;
-- Team can compare both snapshots side-by-sideRelease Snapshots
Scenario: Freezing data state for a report or audit.
CREATE SHARE q4_2025_reconciliation_audit FROM recon_db ACCESS RESTRICTED VISIBILITY HIDDEN;
-- Share URL only with auditors-- Data is frozen and won't changeKey Benefits Summary
| Feature | Benefit |
|---|---|
| Automatic Sync | No manual upload/download workflow |
| Minute-Level Snapshots | Capture state at any point in time |
| Zero-Copy Sharing | Instant sharing without storage duplication |
| Immutable Snapshots | Shared state never changes unless explicitly updated |
| URL-Based Access | Simple distribution (like Google Docs) |
| S3 Compatible | Leverages standard object storage |
Limitations and Considerations
Cloud Dependency
- Requires internet connection for sync/sharing
- Data stored in MotherDuck’s cloud (not self-hosted)
- Local queries still work offline
Cost
- Free tier available
- Usage-based pricing for larger datasets
- Storage costs scale with total data + delta history
Access Control
- Organization-level or public sharing only
- No fine-grained per-user permissions within a share
- Hidden shares require restricted access
Alternatives Comparison
| Feature | MotherDuck | DuckLake | Manual S3 |
|---|---|---|---|
| Auto-sync | ✅ Built-in | ❌ Manual | ❌ Manual |
| Snapshots | ✅ Minute-level | ✅ Commit-based | ❌ Manual backups |
| URL Sharing | ✅ Built-in | ❌ Manual distribution | ❌ Pre-signed URLs |
| Zero-Copy | ✅ Differential layers | ✅ Git-like storage | ❌ Full file copies |
| Cost | 💰 Paid (free tier) | Free (open source) | 💰 S3 storage only |
| Self-Hosted | ❌ Cloud service | ✅ Local or cloud | ✅ Your S3 |
Sources
- Differential Storage Architecture
- CREATE SNAPSHOT Documentation
- CREATE SHARE Documentation
- Sharing Overview
- Managing Shares
- Updating Shares
- MotherDuck Sharing Announcement
Last Updated
January 7, 2026