Iceberg Time Travel is the ability to query an Iceberg table as it existed at any past snapshot or timestamp for which a snapshot has been retained. Because every write to an Iceberg table creates an immutable snapshot that references the complete set of data files active at that point, any snapshot can be read without restoring data or maintaining a separate historical copy. The query planner simply reads the manifest list for the target snapshot instead of the current snapshot.

Time travel is enabled by the immutability of Iceberg's data files. Once a Parquet file is written to object storage as part of an Iceberg commit, it is never modified. This means every past snapshot's data files remain intact and readable until explicitly deleted by the expire_snapshots maintenance procedure.

SQL Syntax

Different engines expose time travel through slightly different syntax. In Dremio and Spark, the AS OF clause is used:

-- Query by timestamp
SELECT * FROM catalog.db.orders
AS OF TIMESTAMP '2025-01-15 00:00:00';

-- Query by snapshot ID
SELECT * FROM catalog.db.orders
AS OF VERSION 8764523190123456;

Trino uses the same FOR VERSION AS OF and FOR TIMESTAMP AS OF syntax. Spark DataFrames support time travel through the option("as-of-timestamp", ...) or option("snapshot-id", ...) reader options. The underlying mechanism is the same regardless of syntax: the engine uses the specified snapshot (or the snapshot whose timestamp most closely precedes the requested timestamp) as the read target.

Use Cases

Time Travel Limits

Time travel is only available for snapshots that have not been expired. Once expire_snapshots removes a snapshot, that point in time is no longer queryable and the data files exclusively belonging to that snapshot are deleted from storage. The snapshot retention window (typically configured via the history.expire.max-snapshot-age-ms table property) must be set to at least as long as the organization's audit and debugging requirements demand.

Master the Agentic Lakehouse

Start building today with free trials and authoritative resources.

Architecting an Apache Iceberg Lakehouse

Architecting an Apache Iceberg Lakehouse

Buy on Manning
The AI Lakehouse

The AI Lakehouse

Buy on Amazon
Apache Iceberg and Agentic AI

Apache Iceberg and Agentic AI

Buy on Amazon
Lakehouse Built for Everyone

Lakehouse Built for Everyone

Buy on Amazon