When RisingWave streams data into Iceberg, it continuously creates snapshots that capture the state of a table or a sink at a given point in time. Over time, these snapshots accumulate and consume storage. Regularly expiring old snapshots helps keep storage usage under control and improves query performance.

Periodic expiration

RisingWave supports automatic snapshot expiration for sinks and engine tables. At user-defined intervals, the system evaluates existing snapshots and removes those that are older than the configured threshold or exceed the retention count. You can also configure whether to clean up expired data and metadata files. To enable snapshot expiration, specify the following parameters in the WITH clause when creating a sink or table:
ParameterDescription
enable_snapshot_expirationWhether to enable snapshot expiration. By default, it removes snapshots older than 5 days.
snapshot_expiration_max_age_millisThe maximum age (in milliseconds) for snapshots before they expire. For example, if set to 3600000, snapshots older than 1 hour will be expired. If you want to keep only the latest snapshot, set snapshot_expiration_max_age_millis = 0.
snapshot_expiration_retain_lastThe number of snapshots to retain.
snapshot_expiration_clear_expired_filesWhether to delete expired data files. Default is true.
snapshot_expiration_clear_expired_meta_dataWhether to delete expired metadata files. Default is true.
max_snapshots_num_before_compactionThe maximum number of snapshots allowed since the last rewrite operation. If set, sink will check snapshot count and wait if exceeded.
For detailed syntax, parameters, and configuration details, see Compaction for Iceberg sink and Compaction for Iceberg engine table.

Manual expiration

In addition to periodic background expiration, you can also expire snapshots manually. By running the VACUUM FULL command, RisingWave will expire old snapshots on demand. This is useful when you want to immediately reclaim storage or reset snapshot history.