Skip to main content
Iceberg supports branches and tags as named references to snapshots, enabling sophisticated snapshot lifecycle management beyond basic time travel. These features are essential for data quality workflows, auditing, and experimental data engineering.

Understanding Snapshots

Every commit to an Iceberg table creates a snapshot - a complete, immutable view of the table at a point in time:
Snapshots enable:
  • Reader isolation - Queries see a consistent view
  • Time travel - Query historical data
  • Rollback - Revert to previous states
  • Incremental processing - Track changes between snapshots

Snapshot Retention

By default, all snapshots are retained until explicitly expired. The expire_snapshots procedure removes old snapshots:
However, basic retention has limitations:
  • All snapshots are treated equally
  • Important snapshots can be accidentally expired
  • No way to retain specific historical points
Branches and tags solve these problems by providing independent lifecycle management.

Tags: Named Historical Snapshots

Tags are named references to snapshots with their own retention policies:

Tag Properties

  • Immutable - Tags always point to the same snapshot
  • Named - Easy to remember and reference (Q4-2023 vs snapshot ID 8372649283746)
  • Independent retention - Each tag has its own max age
  • Lightweight - Just metadata, no data duplication

Tag Retention

Tags control when both the reference and the snapshot can be deleted:
When expire_snapshots runs:
  1. Expired tags are removed
  2. Snapshots referenced only by expired tags can be deleted
  3. Snapshots referenced by active tags are preserved

Tag Use Cases

Retain monthly snapshots for auditing:
Mark production releases:
Create recovery points before risky operations:
Implement tiered retention (daily/weekly/monthly/yearly):

Branches: Independent Lineages

Branches are mutable named references that can have new snapshots committed to them:

Branch vs Tag

Branch Retention

Branches have two retention settings:
  • Branch retention - How long the branch reference exists
  • Snapshot retention - How many snapshots to keep on the branch
When expire_snapshots runs:
  • Snapshots beyond the retention count are deleted
  • After branch expires, all its snapshots can be deleted

Branch Use Cases

Validate data before making it visible:
Test changes without affecting production:
Separate staging from production data:
Isolate concurrent data pipelines:

Schema with Branches and Tags

Important: Schema is tracked at the table level, not per branch.
When working with branches:
  • Writing to a branch uses the table’s current schema
  • Querying a branch uses the table’s current schema
  • Time travel to a snapshot uses the snapshot’s historical schema
Example:

Working with Branches and Tags

Creating

Reading

Writing

Merging

Deleting

Retention Policy Example

Comprehensive retention strategy:

Best Practices

Tags are perfect for points you want to preserve:
  • End of reporting periods
  • Production releases
  • Compliance checkpoints
  • Pre/post migration backups
Branches work well for ongoing development:
  • Feature development and testing
  • Data quality validation
  • Staging environments
  • Experimental analyses
Balance storage cost with recovery needs:
  • Short-lived branches (1-7 days) for testing
  • Medium-term tags (30-90 days) for regular backups
  • Long-term tags (years) for compliance
Use clear naming conventions:
  • daily-YYYY-MM-DD for daily snapshots
  • weekly-YYYY-Www for weekly snapshots
  • monthly-YYYY-MM for monthly snapshots
  • prod-release-vX.Y.Z for releases
  • experiment-description for tests
Too many references can slow metadata operations:
  • Regularly clean up expired branches
  • Automate tag creation/cleanup
  • Use expire_snapshots regularly

Learn More

Table Format

Understand snapshots and metadata structure

Reliability

Learn about Iceberg’s consistency guarantees