databricks Data Engineer Professional · Practice questions

Section 5: Cost and Performance Optimization Practice Questions

Review 10 sample questions with their correct answers and explanations. Sign up free to continue with the full topic quiz.

Sign up free for the full quiz

Question 1

A gold table joins a large fact table with several dimensions nightly using a full recompute that takes 3 hours. Only 1% of facts change. What is a better approach?

  1. Disable the job
  2. Recompute every hour
  3. Process only changed data incrementally — Correct
  4. Add more workers and keep the full recompute

Correct answer

Process only changed data incrementally

Explanation

Incremental processing avoids recomputing unchanged data.

Question 2

A query in the Spark UI shows a BroadcastNestedLoopJoin taking hours. What is the most likely cause?

  1. Photon being enabled, which converts every hash join into a nested loop join
  2. A non-equi or missing join condition — Correct
  3. A properly written equi-join on a primary key, which Spark always executes as a nested loop
  4. Too few columns in the select list, which forces nested loop joins

Correct answer

A non-equi or missing join condition

Explanation

Nested loop joins arise from conditions without equality keys; rewriting with equi-join keys or ranges helps.

Question 3

Which file sizing guidance is generally appropriate for large Delta tables read by analytic queries?

  1. Files of about 1 KB
  2. Files of roughly 128 MB to 1 GB, managed by OPTIMIZE or auto-tuning — Correct
  3. Exactly one file per row, so that updates rewrite as little data as possible during MERGE operations
  4. One file per table

Correct answer

Files of roughly 128 MB to 1 GB, managed by OPTIMIZE or auto-tuning

Explanation

Moderately large files balance scan efficiency and parallelism; Databricks auto-tunes sizes.

Question 4

Which statement about materialized view incremental refresh is correct?

  1. It always performs a full recompute
  2. It is used when the query and source support it — Correct
  3. It requires external tables
  4. It cannot be used with joins

Correct answer

It is used when the query and source support it

Explanation

Databricks chooses incremental or full refresh based on the query and source capabilities.

Question 5

A MERGE source has 10 million rows and the target 5 billion rows. The join key is the target's clustering key. Which join strategy is typically chosen, and why does clustering help?

  1. No join
  2. A shuffle or broadcast join with file pruning on the clustered key — Correct
  3. A nested loop join on the driver, which scales best for large MERGE operations with billions of rows
  4. A cross join, because MERGE always compares every source row with every target row

Correct answer

A shuffle or broadcast join with file pruning on the clustered key

Explanation

Clustering on the merge key lets Delta prune target files during the join.

Question 6

Which property enables optimized writes and auto compaction to reduce small files during writes?

  1. delta.logRetentionDuration
  2. delta.autoOptimize.optimizeWrite and autoCompact — Correct
  3. delta.enableChangeDataFeed
  4. delta.columnMapping.mode

Correct answer

delta.autoOptimize.optimizeWrite and autoCompact

Explanation

Optimized writes produce larger files; auto compaction compacts small files after writes.

Question 7

A stage shows high 'Shuffle Read Blocked Time'. What does this suggest?

  1. Tasks wait on fetching shuffle data over the network — Correct
  2. The table has too many Delta versions
  3. The cluster is using too much cache memory
  4. The driver is computing the query plan for too long

Correct answer

Tasks wait on fetching shuffle data over the network

Explanation

Blocked time indicates network or remote fetch bottlenecks.

Question 8

A table has thousands of small files because a streaming job writes every 10 seconds. Which change reduces small files most directly?

  1. Lower the trigger interval to 1 second so that each file is even smaller
  2. Partition the table by event second
  3. Enable auto compaction and optimized writes — Correct
  4. Disable the checkpoint for the stream

Correct answer

Enable auto compaction and optimized writes

Explanation

Auto compaction and optimized writes consolidate small files from frequent writes.

Question 9

A table is read by many teams with different filters, and query patterns evolve. Which layout strategy needs the least manual tuning?

  1. No layout optimization
  2. Hive-style partitioning by three columns
  3. Automatic liquid clustering — Correct
  4. Manual ZORDER weekly on all columns

Correct answer

Automatic liquid clustering

Explanation

Automatic clustering adapts keys to observed query patterns.

Question 10

Which approach keeps gold tables efficient for dashboards that always show the last 90 days?

  1. Pre-aggregate and cluster on date — Correct
  2. Use dynamic views over bronze
  3. Store gold as JSON
  4. Compute aggregates from bronze at query time

Correct answer

Pre-aggregate and cluster on date

Explanation

Pre-aggregation and clustering on common filters speed reads.

Ready for the full quiz?

Create a free QuizAnalyst account to practice the complete question set and save your progress.

Sign up free for the full quiz