A data analyst is troubleshooting a slow-running SQL query against a massive Delta table in Databricks. The query frequently scans the entire table despite filtering on a high-cardinality timestamp column. Which approach will most effectively reduce the data scanned by eliminating full-table reads?
Trap 1: Increase the cluster size to a driver instance with more memory to…
Scaling up cluster memory does not address the fundamental I/O bottleneck caused by scanning unindexed and unclustered data files from cloud object storage. Query performance remains poor because the underlying data layout still requires reading all historical partitions into memory.
Trap 2: Execute a VACUUM command with a retention threshold of zero hours…
VACUUM removes unreferenced old data files after the retention threshold; it does not reorganise data for read pruning, so full scans on the timestamp filter persist. It tempts because it reduces storage footprint, but the correct fix is liquid clustering or partitioning on that column to enable file skipping.
Trap 3: Convert the Delta table format to standard Parquet files to take…
Delta Lake is built on top of Parquet files and adds transaction logs, statistics, and advanced optimization features like Z-Ordering. Reverting to standard Parquet removes these built-in metadata capabilities, degrading overall query planning and update performance.
- A
Run an OPTIMIZE command with a ZORDER BY clause on the timestamp column to co-locate related data and improve data skipping.
Z-Ordering clusters data with similar values into the same file spaces. This enables the Delta Lake file-skipping mechanism to bypass irrelevant files entirely when queries apply range filters on the target timestamp column, directly lowering overall scan volume and query duration.
- B
Increase the cluster size to a driver instance with more memory to hold the entire uncompressed Delta table in cache.
Why it fails: Scaling up cluster memory does not address the fundamental I/O bottleneck caused by scanning unindexed and unclustered data files from cloud object storage. Query performance remains poor because the underlying data layout still requires reading all historical partitions into memory.
- C
Execute a VACUUM command with a retention threshold of zero hours to purge old data files immediately.
Why it fails: VACUUM removes unreferenced old data files after the retention threshold; it does not reorganise data for read pruning, so full scans on the timestamp filter persist. It tempts because it reduces storage footprint, but the correct fix is liquid clustering or partitioning on that column to enable file skipping.
- D
Convert the Delta table format to standard Parquet files to take advantage of native Apache Spark partitioning.
Why it fails: Delta Lake is built on top of Parquet files and adds transaction logs, statistics, and advanced optimization features like Z-Ordering. Reverting to standard Parquet removes these built-in metadata capabilities, degrading overall query planning and update performance.