Databricks Data Engineer Associate Question 306
Single answerWhen using the OPTIMIZE command in Databricks on a Delta table, which type of files does it compact?
- A
Small files below a predefined size threshold
- B
Large files exceeding a predefined size threshold
- C
Corrupted files in the Delta table
- D
All files in the Delta table regardless of size
Show answer and explanation
Correct answer: A
Explanation
The OPTIMIZE command in Databricks is used to improve the performance of Delta tables by compacting small files into larger ones, which improves query execution efficiency and reduces metadata overhead. This is particularly useful for tables with frequent small writes, which can result in many small files.
- A. Correct.
Correct: The OPTIMIZE command is designed to compact small files below a predefined size threshold to improve query performance and reduce overhead.
- B. Incorrect.
Incorrect: Large files exceeding a predefined size threshold are not compacted by OPTIMIZE. Instead, the goal of OPTIMIZE is to consolidate smaller files into larger ones.
- C. Incorrect.
Incorrect: The OPTIMIZE command does not handle corrupted files. Corruption issues require different troubleshooting steps.
- D. Incorrect.
Incorrect: OPTIMIZE does not compact all files in the Delta table. It specifically targets small files within the table.