Delta transaction log, optimistic concurrency, and MERGE failure modes
The log is the table. Everything else, including every MERGE failure, follows from that.
The transaction log is the table
holds JSON commit files plus periodic Parquet checkpoints that compact a long run of JSON commits into a single readable snapshot. A reader resolves a version of the table by replaying the log up to a point in time, not by scanning whatever Parquet files happen to sit in the table's directory.
Because reading means resolving a snapshot from the log rather than acquiring any lock, readers never block writers and writers never block readers. A long-running query reads a consistent snapshot even while new commits land underneath it.
Optimistic concurrency
A writer reads a table version, does its work against that version, and then attempts to commit. The commit succeeds only if nothing conflicting landed on the table in the meantime; if it did, the writer either retries against the new version or fails outright.
Two concurrent writers touching entirely different files rarely conflict, since blind appends to different parts of the table don't overlap. A touching overlapping partitions is much more likely to conflict, since two concurrent MERGE operations may both try to rewrite the same underlying files.
MERGE failure modes
Multiple source rows matching one target row throws an error unless the source is deduplicated first; Delta refuses to guess which of several matching source rows should update a given target row.
A MERGE without partition predicates scans the whole table to find matches, even when the actual matching rows are concentrated in one small partition, because Delta has no way to prune directories it isn't told to filter on.
MERGE rewrites whole files, not individual rows, since Parquet files are immutable. Updating a handful of rows scattered across many files means rewriting all of those files in full, so write amplification is real and can dominate the cost of an otherwise small logical update.
MERGE failure modes and fixes
| Failure | Cause | Fix |
|---|---|---|
| Multiple source matches error | Non-unique match key in source | Dedupe the source before MERGE |
| Full table scan | No partition predicate in the MERGE condition | Add a partition-column filter to the ON clause |
| High write amplification | Rewriting whole files for scattered row updates | Cluster or Z-order on the merge key to localize matching rows |
Time travel and VACUUM are in tension
Old file versions stay readable (via , for example a query AS OF a prior version) until physically deletes them. The default 7-day retention is what makes rollback to a recent version possible after a bad write.
Vacuuming aggressively to reclaim storage sooner removes the ability to recover from exactly the kind of mistake that time travel exists to protect against. Shortening retention is a direct trade against your own recovery window.
A VACUUM run with an aggressively short retention window can permanently foreclose a rollback you don't yet know you'll need.
Evidence: reading the log and history
DESCRIBE HISTORY on a Delta table shows every commit, its operation type, and the metrics logged with it (such as rows merged or files rewritten). Listing _delta_log directly shows the raw JSON commit files and Parquet checkpoint files backing that history.
Video
Worked example
A logical file removal still allows an older read
Version 7 stores order 42 with amount 10 in file A. A MERGE commits version 8 with replacement file B and amount 15.
| Read request | File needed | Outcome |
|---|---|---|
| Current version 8 | B | amount = 15 |
| Time travel to version 7 | A, while retained | amount = 10 |
| Version 7 after eligible A is vacuumed | A is missing | Old data can no longer be read |
What to notice: Removing A from the active snapshot does not immediately delete it. VACUUM physically removes eligible old files, so recovery and time-travel requirements must inform retention.
Practice / self-test
1. Why do Delta readers never block on a concurrent writer?
Reveal answer
Readers resolve a consistent snapshot from the transaction log rather than acquiring a lock on the current files, so a writer committing a new version doesn't interfere with a reader that's already resolved an earlier, still-valid snapshot.
2. Two writers both append new files to a Delta table with no overlapping partitions. Do they conflict?
Reveal answer
Rarely. Blind appends to disjoint files generally don't touch the same underlying data, so allows both commits to succeed without a conflict.
3. A MERGE throws "multiple source rows matched". What's the fix?
Reveal answer
Deduplicate the source data on the match key before running the MERGE, since Delta requires exactly one source row per matched target row and refuses to guess otherwise.
4. A MERGE on a 10 TB partitioned table takes hours even though only one day's data changed. What's missing?
Reveal answer
A partition predicate in the MERGE's ON clause. Without one, Delta scans the whole table to find matches instead of pruning to the relevant partition.
5. Why does VACUUM with a very short retention period threaten rollback capability?
Reveal answer
Time travel depends on old file versions still existing on disk. VACUUM physically deletes versions older than its retention window, so a short window removes the ability to roll back to anything beyond that recent point.