

# Time travel queries on Iceberg tables

To read an Iceberg table as of an earlier snapshot, follow the table name with `AT (VERSION => ``snapshot_id``)`. To read it as it was at a point in time, use `AT (TIMESTAMP => ``timestamp``)`. The query reads the snapshot that was current at that time.

To list the snapshots of a table, with their IDs and commit times, call `iceberg_snapshots('``database`.`table``')`.

## Syntax
<a name="athena-duckdb-statement-select-time-travel-syntax"></a>

```sql
{{table}} [ [ AS ] {{alias}} ] AT ( VERSION => {{snapshot_id}} )
{{table}} [ [ AS ] {{alias}} ] AT ( TIMESTAMP => {{timestamp}} )
```

## Examples
<a name="athena-duckdb-statement-select-time-travel-examples"></a>

For a description of the sample tables that the examples on this page use, see [SELECT statement in DuckDB](duckdb-statement-select.md).

The following SQL query counts the rows of the first snapshot of `orders_iceberg`, before the third order was added.

```sql
SELECT count(*) AS orders
FROM sales_db.orders_iceberg AT (
    VERSION => 1294122691170353594
)
```

The query returns the following result.


| orders | 
| --- | 
| `2` | 

The following SQL query reads the table as it was at a time between its two snapshots. The alias comes before `AT`.

```sql
SELECT o.order_id, o.customer
FROM sales_db.orders_iceberg AS o AT (
    TIMESTAMP => TIMESTAMP '2026-11-24 05:28:21'
)
ORDER BY o.order_id
```

The query returns the following results.


| order\_id | customer | 
| --- | --- | 
| `1` | `alice` | 
| `2` | `bob` | 

## Considerations
<a name="athena-duckdb-statement-select-time-travel-considerations"></a>

Put a table alias before `AT`, as in `FROM orders AS o AT (VERSION => 1234)`. An alias after `AT (...)` is a syntax error.

Time travel to an Iceberg branch or tag is not supported.

## Differences from Athena engine version 3
<a name="athena-duckdb-statement-select-time-travel-differences-from-engine-version-3"></a>

Athena engine version 3 reads an earlier snapshot with `FOR VERSION AS OF` `snapshot_id`. In DuckDB, write `AT (VERSION => ``snapshot_id``)`.

Athena engine version 3 reads a table as of a point in time with `FOR TIMESTAMP AS OF` `timestamp`. In DuckDB, write `AT (TIMESTAMP => ``timestamp``)`.

Athena engine version 3 lists snapshots from the `"``table``$snapshots"` metadata table. In DuckDB, call `iceberg_snapshots('``database`.`table``')`.