DATABRICKS-DATA-ENGINEER-ASSOCIATE practice question 19 of 25
A data engineer has realized that the data files associated with a Delta table are incredibly small. They want to compact the small files to form larger files to improve performance. Which of the following keywords can be used to compact the small files?
Full set: 177 questionsThe OPTIMIZE command is the correct tool in Delta Lake for compacting small files into larger ones. This process, known as file compaction or bin-packing, rewrites existing data files to reduce their number and increase their size. Having fewer, larger files significantly improves the read performance of queries on the table, as the query engine needs to open and process fewer files. The command can be run on an entire table or on specific partitions.
A. REDUCE: This is not a valid SQL or Delta Lake command for file management. It is a concept often associated with data processing transformations (e.g., reduceByKey in Spark RDDs).
C. COMPACTION: While "compaction" is the term for the process of combining small files, it is not the actual keyword used in the Delta Lake command. The command itself is OPTIMIZE.
D. REPARTITION: This is a DataFrame transformation used to control the number of data partitions before writing data. It is not used to optimize the file layout of an existing Delta table.
E. VACUUM: The VACUUM command is used for garbage collection. It removes data files that are no longer referenced by the Delta table's transaction log and are older than the retention period.
1. Databricks Documentation
"Compact small files into larger ones using OPTIMIZE": "Delta Lake on Databricks can improve the speed of read queries from a table by coalescing small files into larger ones. You can trigger compaction by running the OPTIMIZE command."
Source: Databricks Documentation > Delta Lake > Table utility commands > OPTIMIZE.
2. Databricks Documentation
"What is VACUUM?": "You can remove files that are no longer referenced by a Delta table and are older than the retention threshold by running the VACUUM command on the table." This distinguishes its purpose from OPTIMIZE.
Source: Databricks Documentation > Delta Lake > Table utility commands > VACUUM.
3. Learning Spark
2nd Edition (by Jules S. Damji
et al.): Chapter 9
"Delta Lake
" discusses performance tuning. It explicitly states
"To compact small files
you can use the OPTIMIZE command... This operation is an idempotent operation
meaning that if it’s run twice on the same dataset
the second run has no effect." This confirms OPTIMIZE as the correct command for this task.
Source: O'Reilly
Learning Spark
2nd Edition
Chapter 9
Section: "Compacting Small Files and Z-Ordering".
Keep practicing
Take the free DATABRICKS-DATA-ENGINEER-ASSOCIATE practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DATABRICKS-DATA-ENGINEER-ASSOCIATE practice questions
- Question 1In which of the following scenarios should a data engineer use the MERGE INTO command ins…
- Question 2Which of the following data workloads will utilize a Gold table as its source?
- Question 3A data engineer has developed a data pipeline to ingest data from a JSON source using Aut…
- Question 4Which two components function in the DB platform architecture’s control plane? (Choose tw…
- Question 5Which of the following code blocks will remove the rows where the value in column age is …
- Question 7Which of the following statements regarding the relationship between Silver tables and Br…
