Skip to content

Data Engineer Professional · Domain 5: Cost & Performance Optimization · 15% of the exam

Task 5.2: Choose the appropriate Delta optimization technique (deletion vectors, Liquid Clustering, CLUSTER BY AUTO) for a given table access pattern.

Deletion vectors for row-level changes, clustering keys for filter patterns, automatic key selection, and their interaction with OPTIMIZE, REORG and readers.

Study it

  • Deletion vectors, liquid clustering and CLUSTER BY AUTO

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.

Question 1 · choose 1

A 300 TB table with deletion vectors receives a few thousand erasure deletes a month, touching a small share of its files. No columns have ever been dropped. The monthly REORG TABLE ... APPLY (PURGE) takes many hours because it scans every file footer. How can the data engineer speed it up?

  1. AReplace REORG with VACUUM using a zero-hour retention
  2. BDisable deletion vectors on the table
  3. CRun OPTIMIZE FULL on the table every night instead
  4. DSet spark.databricks.delta.reorg.purgeMode to rows
Show the answer and why
  • AReplace REORG with VACUUM using a zero-hour retention

    Incorrect

    VACUUM removes unreferenced files; it does not rewrite files whose rows are only soft-deleted.

  • BDisable deletion vectors on the table

    Incorrect

    That gives up the faster deletes for every write instead of fixing the purge.

  • CRun OPTIMIZE FULL on the table every night instead

    Incorrect

    Rewriting the whole table nightly costs far more than a targeted purge.

  • DSet spark.databricks.delta.reorg.purgeMode to rows

    Correct

    The rows mode handles only files with soft-deleted rows, which helps when many files have none and no columns were dropped.

By default, purgeMode is all, so a purge scans every Parquet footer for soft-deleted rows and dropped column data. On large tables where many files have no soft-deleted rows and no columns were dropped, rows limits the work to files with soft-deletes.

Question 2 · choose 1

A data engineer wants to cluster an external Delta table, which has 60 columns and no predictive optimization, by device_id, the 45th column. ALTER TABLE ... CLUSTER BY (device_id) fails because the column has no statistics. What should they do?

  1. AAdd device_id to dataSkippingStatsColumns, recompute stats, then cluster
  2. BSet delta.dataSkippingNumIndexedCols to 32 on the table
  3. CPartition the table by device_id instead of clustering it
  4. DRun OPTIMIZE ... ZORDER BY (device_id) together with the new clustering key
Show the answer and why
  • AAdd device_id to dataSkippingStatsColumns, recompute stats, then cluster

    Correct

    Clustering keys need statistics, which by default cover only the first 32 columns; changing the property does not recompute existing statistics.

  • BSet delta.dataSkippingNumIndexedCols to 32 on the table

    Incorrect

    32 columns is already the default, and device_id is the 45th column.

  • CPartition the table by device_id instead of clustering it

    Incorrect

    Partitioning by a high-cardinality column creates huge numbers of small partitions.

  • DRun OPTIMIZE ... ZORDER BY (device_id) together with the new clustering key

    Incorrect

    Liquid clustering is not compatible with ZORDER, and Z-ordering also relies on column statistics.

Clustering keys must be columns with statistics, and Delta tables collect statistics for the first 32 columns by default. Without predictive optimization, delta.dataSkippingStatsColumns names the columns to collect; existing statistics are not recomputed until you compute them again.

Question 3 · choose 1

A table is also read by an older external Delta client that does not support deletion vectors. What happens if the team enables deletion vectors on the table?

  1. AThe client keeps reading the table, but it sees deleted rows
  2. BDatabricks writes a second, compatible copy of the table for the client
  3. CNothing changes for the client until the next VACUUM runs
  4. DThe protocol is upgraded, and that client can no longer read it
Show the answer and why
  • AThe client keeps reading the table, but it sees deleted rows

    Incorrect

    The client cannot read the table at all after the upgrade.

  • BDatabricks writes a second, compatible copy of the table for the client

    Incorrect

    No copy is created.

  • CNothing changes for the client until the next VACUUM runs

    Incorrect

    The protocol changes when the feature is enabled.

  • DThe protocol is upgraded, and that client can no longer read it

    Correct

    Enabling deletion vectors upgrades the table protocol, so clients without deletion vector support cannot read it.

Enabling deletion vectors upgrades the table protocol, after which clients without deletion vector support cannot read the table. On Databricks Runtime 16.4 LTS and above, the feature can be dropped to restore compatibility.

Question 4 · choose 1

A 2 TB table is mostly filtered on one column. A teammate proposes four clustering keys to cover every possible filter. What does Databricks advise?

  1. AUse eight keys, the maximum allowed, so that every filter is covered
  2. BUse four keys, because more clustering keys always help pruning
  3. CUse fewer keys; under 10 TB, extra keys slow single-column filters
  4. DUse no clustering keys and partition the table by all four columns
Show the answer and why
  • AUse eight keys, the maximum allowed, so that every filter is covered

    Incorrect

    The limit is four clustering keys.

  • BUse four keys, because more clustering keys always help pruning

    Incorrect

    On smaller tables, more keys can hurt single-column queries.

  • CUse fewer keys; under 10 TB, extra keys slow single-column filters

    Correct

    Up to four keys are allowed, but for smaller tables extra keys can degrade filtering on a single column.

  • DUse no clustering keys and partition the table by all four columns

    Incorrect

    Partitioning by several columns creates many small partitions.

You can specify up to four clustering keys. For tables under 10 TB, filtering on a single column performs worse with four keys than with two; the difference fades as tables grow.

Question 5 · choose 1

Two jobs often update different rows that sit in the same data files of a Delta table, and one of them keeps failing with a concurrent modification conflict. Which table feature reduces these conflicts?

  1. ADeletion vectors
  2. BChange data feed
  3. CColumn mapping
  4. DType widening
Show the answer and why
  • ADeletion vectors

    Correct

    On Databricks Runtime 14.2 and above, tables with deletion vectors support row-level concurrency.

  • BChange data feed

    Incorrect

    The change feed records changes; it does not resolve write conflicts.

  • CColumn mapping

    Incorrect

    Column mapping allows renames and drops of columns.

  • DType widening

    Incorrect

    Type widening changes column types without rewrites.

Row-level concurrency lets concurrent writes to different rows succeed even when they touch the same files. Tables with deletion vectors support it on Databricks Runtime 14.2 and above.

Question 6 · choose 1

ALTER TABLE ... SET TBLPROPERTIES ('delta.enableDeletionVectors' = true) fails on a pipeline streaming table. How can deletion vectors be enabled on it?

  1. ARun REORG TABLE ... APPLY (PURGE) first, then the ALTER
  2. BSet the property in the streaming table's CREATE statement
  3. CRun OPTIMIZE on the table and then the same ALTER statement
  4. DEnable deletion vectors on the source table instead
Show the answer and why
  • ARun REORG TABLE ... APPLY (PURGE) first, then the ALTER

    Incorrect

    REORG rewrites files; it does not enable the feature.

  • BSet the property in the streaming table's CREATE statement

    Correct

    Deletion vectors cannot be enabled on materialized views or streaming tables with ALTER; use the CREATE statement.

  • CRun OPTIMIZE on the table and then the same ALTER statement

    Incorrect

    The ALTER statement is not supported for these objects.

  • DEnable deletion vectors on the source table instead

    Incorrect

    Source table settings do not change the streaming table's features.

The enableDeletionVectors property turns deletion vectors on or off. For materialized views and streaming tables, it cannot be changed with ALTER; it must be set when the object is created.

Practice domain 5 →Practice all domains →