Set Delta Lake VACUUM retention period and safely reclaim storage from old data files

domain: docs.delta.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Check the current retention threshold with SHOW TBLPROPERTIES delta.`/path/to/table` and look for delta.deletedFileRetentionDuration (default 7 days / interval 168 hours).
  2. Set a custom retention with ALTER TABLE delta.`/path/to/table` SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = 'interval 14 days').
  3. Before running VACUUM, optionally do a dry run to see what would be deleted: VACUUM delta.`/path/to/table` RETAIN 168 HOURS DRY RUN.
  4. Execute VACUUM: VACUUM delta.`/path/to/table` RETAIN 168 HOURS; confirm the files deleted and total bytes reclaimed from the output.
  5. If you must drop retention below 7 days (not recommended), first set spark.databricks.delta.retentionDurationCheck.enabled = false or the equivalent Delta OSS config to bypass the safety check.

Known gotchas

Related routes

Delta Lake OPTIMIZE and VACUUM
docs.delta.io · 5 steps · unrated
Enable and manage Delta Lake liquid clustering to replace static partition schemes
docs.delta.io · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans