Interview/Databricks

Delta MERGE interview questions

Interactive Databricks interview questions on Delta MERGE. Same topic as /learn/databricks/merge. MERGE INTO upserts a change set into a Delta table by rewriting only the files that the join key touches.

Lesson · Simulation

beginner
Delta MERGE

What does MERGE INTO do on Delta?

Answer it out loud, then reveal. Play steps through like the simulators.

Production scenario

Delta MERGE

Hourly MERGE, table is 4 million tiny files

Symptoms

  • Each MERGE added files
  • Next scan launches millions of tasks

All questions on this page

Indexed as FAQ. Open any item if you prefer a list to Play.

beginner

What does MERGE INTO do on Delta?

Delta MERGE · tap to open the answer

Short: Match keys, update/insert/delete, rewrite touched files, one atomic commit.

Detailed: It is not an in-place row edit on Parquet. Files that contain matched rows are rewritten. Tiny files after many MERGEs need OPTIMIZE.

Common mistake: Thinking MERGE updates a row in a single Parquet file like a database page.

Follow-up: What happens to unmatched target rows by default?

Lesson · Simulation

intermediate

Why did MERGE rewrite 40% of the table to change 0.1% of rows?

Delta MERGE · tap to open the answer

Short: Those rows lived in large files (or unclustered files) so whole files were copied.

Detailed: Partition / liquid clustering / Z-ORDER so a key lives in fewer files. MERGE ON a selective condition. Don't MERGE a full snapshot if you have change data.

Common mistake: OPTIMIZE after every MERGE in the same transaction as a religion without measuring file size.

Follow-up: How do you MERGE only yesterday's partition?

Lesson · Simulation

senior

Concurrent MERGEs fail with ConcurrentAppendException. What's the design change?

Delta MERGE · tap to open the answer

Short: Isolate partitions / rows so commits don't conflict, or serialize writers.

Detailed: Two jobs rewriting the same files. Partition the table by the merge boundary (date). One writer per partition. Retry is OK; 50 retries is a design bug.

Senior: When you replace a whole partition from a correct snapshot — cheaper than matching every key.

Common mistake: Turning off optimistic concurrency.

Follow-up: When is a replaceWhere overwrite better than MERGE?

Lesson · Simulation