Expiring Snapshots of Apache Iceberg Tables
Each write to an Iceberg table creates a snapshot of that table. A snapshot is a timestamped version of a table.
You can query snapshots by using time travel queries. You can also rollback a table to any snapshot.
As snapshots accumulate, the data files that are unique to them take up more and more storage. Also, the more snapshots a table has, the greater is the size of its metadata. You can "expire" snapshots to delete the data files that are unique to them and to remove them from table metadata. It is recommended that you expire them regularly.
Expired snapshots are no longer available for time travel queries.
Only data files that are unique to a snapshot are deleted immediately when that snapshot is expired. Data files that are also used by other, active snapshots are not deleted, so that those snapshots can still be queried with time travel queries.
Expiring a snapshot also deletes other files related to it, such as the manifest file, manifest list file, and partition stats files.
For the SQL command to expire snapshots, see VACUUM TABLE.