Databricks Data Engineer Associate Question 301
Single answerYou are managing a Delta Lake table in Databricks, and you have recently deleted a large number of records from the table. You want to permanently remove these deleted records to free up storage space. Which of the following statements about the VACUUM command in Delta Lake is correct?
- A
The VACUUM command permanently removes deleted records by default, regardless of whether they are committed or not.
- B
The VACUUM command removes only those deleted files that are no longer referenced by any Delta table commits.
- C
The VACUUM command can be used to recover deleted files if issued within the default retention period.
- D
The VACUUM command requires a table to have a retention period of at least 0 hours.
Show answer and explanation
Correct answer: B
Explanation
The VACUUM command in Delta Lake is used to permanently delete data files that are no longer referenced by any Delta table commit, thereby reclaiming storage space. It does not operate on uncommitted data and respects the retention period configured for safety. The default retention period is 168 hours (7 days), ensuring that data files are not accidentally deleted.
- A. Incorrect.
This is incorrect because the VACUUM command only removes files that are no longer referenced by Delta table commits. It does not delete uncommitted data.
- B. Correct.
This is correct because the VACUUM command ensures that only files not referenced by any active Delta table version (commits) are permanently deleted.
- C. Incorrect.
This is incorrect because the VACUUM command is used to permanently delete unused data files, not to recover them.
- D. Incorrect.
This is incorrect because the minimum retention period for the VACUUM command is 168 hours by default (7 days), unless explicitly overridden, but it cannot be set to 0 hours.