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 theWITH
clause when creating a sink or table:
Parameter | Description |
---|---|
enable_snapshot_expiration | Whether to enable snapshot expiration. By default, it removes snapshots older than 5 days. |
snapshot_expiration_max_age_millis | The 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_last | The number of snapshots to retain. |
snapshot_expiration_clear_expired_files | Whether to delete expired data files. Default is true . |
snapshot_expiration_clear_expired_meta_data | Whether to delete expired metadata files. Default is true . |
max_snapshots_num_before_compaction | The maximum number of snapshots allowed since the last rewrite operation. If set, sink will check snapshot count and wait if exceeded. |
Manual expiration
In addition to periodic background expiration, you can also expire snapshots manually. By running theVACUUM FULL
command, RisingWave will expire old snapshots on demand. This is useful when you want to immediately reclaim storage or reset snapshot history.