deltalake_core::operations

Module vacuum

Source
Expand description

Vacuum a Delta table

Run the Vacuum command on the Delta Table: delete files no longer referenced by a Delta table and are older than the retention threshold. We do not recommend that you set a retention interval shorter than 7 days, because old snapshots and uncommitted files can still be in use by concurrent readers or writers to the table.

If vacuum cleans up active files, concurrent readers can fail or, worse, tables can be corrupted when vacuum deletes files that have not yet been committed. If retention_period is not set then the configuration.deletedFileRetentionDuration of delta table is used or if that’s missing too, then the default value of 7 days otherwise.

When you run vacuum then you cannot use time travel to a version older than the specified retention period.

Warning: Vacuum does not support partitioned tables on Windows. This is due to Windows not using unix style paths. See #682

§Example

let mut table = open_table("../path/to/table")?;
let (table, metrics) = VacuumBuilder::new(table.object_store(). table.state).await?;

Structs§

Traits§