VACUUM TABLE is a Dremio SQL command for expiring Apache Iceberg snapshots and deleting files no longer referenced by the remaining snapshots. It reduces storage usage while preserving the active table state, but removes access to expired historical versions. section 10.3.1
Use retention settings to balance storage, recovery, governance, and workload behavior:
- Set older_than to expire snapshots before a specific timestamp and retain_last to preserve a baseline number of recent snapshots. section 10.3.1
- Without parameters, Dremio retains the last snapshot and removes snapshots older than five days. section 10.3.1
- Keep expiration intervals longer than the maximum expected query duration; expiring a query's starting snapshot can cause the query to fail. section 10.3.1
Expire older snapshots
VACUUM TABLE s3.sales EXPIRE SNAPSHOTS older_than '2024-06-01 00:00:00.000' retain_last 20;
Figure 10.9 When Snapshot 1 expires, only metadata or data files that aren’t associated with the remaining snapshots are deleted.
Shows that expiration deletes only metadata and data files not associated with the snapshots that remain. section 10.3.1
