DP-700 practice question 8 of 25

You have a Fabric workspace that contains a lakehouse and a notebook named Notebook1. Notebook1 reads data into a DataFrame from a table named Table1 and applies transformation logic. The data from the DataFrame is then written to a new Delta table named Table2 by using a merge operation. You need to consolidate the underlying Parquet files in Table1. Which command should you run?

Full set: 129 questions
Answer options
A: VACUUM
B: BROADCAST
C: OPTIMIZE Correct answer
D: CACHE
Correct Answer:
C. OPTIMIZE
Explanation

The OPTIMIZE command is specifically designed to improve the performance of queries on a Delta table by compacting small files into fewer, larger ones. This process, known as file compaction, directly addresses the requirement to "consolidate the underlying Parquet files." Consolidating files reduces the metadata overhead and improves I/O efficiency, leading to faster read operations. The command can be run on a table to rewrite the data files for better layout and size.

Why Incorrect

A. VACUUM: This command is used for garbage collection. It removes data files that are no longer referenced by a Delta table and are older than the retention threshold, but it does not consolidate active files.
B. BROADCAST: This is a join hint in Apache Spark. It instructs the query optimizer to broadcast a smaller table to all worker nodes for a join operation, which is unrelated to file management.
D. CACHE: This command loads a table or DataFrame into the memory of the Spark cluster. It improves performance for subsequent queries on the same data but does not alter or consolidate the physical files in storage.

References

1. Microsoft Learn Documentation: In the article "Delta Lake table optimization and V-Order

" it states

"The OPTIMIZE command is a file compaction operation. It's binary-compatible

meaning you can run OPTIMIZE on a Delta Lake table

and then read it with a lower Databricks Runtime version. It aims to produce evenly-sized files... coalescing many small files into fewer

larger ones."

Source: Microsoft Learn

"Delta Lake table optimization and V-Order"

Section: "What is OPTIMIZE?".

2. Delta Lake Official Documentation: The documentation for OPTIMIZE clearly defines its purpose: "Optimizes the layout of Delta Lake data. Optionally optimizes a subset of data or reorders data by column. If you do not specify reordering

bin-packing optimization is performed." Bin-packing is the process of consolidating small files.

Source: Delta.io Documentation

"OPTIMIZE"

Command syntax and description.

3. Delta Lake Official Documentation: The VACUUM command's purpose is contrasted with OPTIMIZE: "Recursively vacuum directories associated with the Delta table and remove data files that are no longer in the latest state of the transaction log for the table and are older than a retention threshold." This confirms it is for cleanup

not consolidation.

Source: Delta.io Documentation

"VACUUM"

Command syntax and description.

4. Apache Spark Documentation: The documentation for caching explains its function: "Spark SQL can cache tables using an in-memory columnar format... Spark SQL will scan only required columns and will automatically tune compression to minimize memory usage and GC pressure." This highlights its role in memory management

not physical file consolidation.

Source: Apache Spark™ 3.5.0 Documentation

"SQL Reference - Caching Data".

Scroll to Top