Delta, Iceberg, or Hudi
Concepts covered: Cost Optimization
All 3 formats give the previous sections' guarantees: atomic commits over immutable Parquet files, snapshot reads, time travel and schema evolution. They differ in how the metadata is laid out, which decides 3 properties: how planning scales with file count, how row updates get written, and how many engines can share a table.
3 ways to lay out metadata
| Aspect | Delta | Iceberg | Hudi |
|---|---|---|---|
| Metadata | Ordered JSON commits plus Parquet checkpoints | A tree: metadata file, manifest list, manifests | A timeline of instants in a .hoodie folder |
| A version is | An integer commit number | A snapshot ID | An instant, keyed by commit time |
| A commit is | Creating the next numbered file | Swapping the catalog's pointer to a new metadata file | Completing an instant on the timeline |
| Row updates | File rewrites, or deletion vectors that mark rows removed | File rewrites, or delete files (format v2) | Copy-on-write or merge-on-read, set per table |
| Built for | Spark-centric batch and merge work | Huge tables shared by several engines | Keyed upserts and pulling only changed rows |
Iceberg's tree and why it scales
Iceberg's metadata is a tree, so it has no log to replay. The catalog holds a pointer to the current metadata file, which names the current snapshot's manifest list. The manifest list names manifests and records the range of partition values each covers, and each manifest lists data files with their column stats. Planning walks down the tree and skips whole manifests whose range misses the filter, so its work follows the files a query might need, while a log replay starts from an entry for every live file.
- Catalog (custom, current pointer)
- Metadata file (storage, schema, snapshots)
- Manifest list (storage, snapshot 3)
- Manifest A (storage, 2024-03-01 to 03-07)
- Manifest B (storage, 2024-03-08 to 03-15)
- Data files A (storage, Parquet)
- Data files B (storage, Parquet)
- Catalog -> Metadata file
- Metadata file -> Manifest list
- Manifest list -> Manifest A
- Manifest list -> Manifest B
- Manifest A -> Data files A
- Manifest B -> Data files B
The tree also allows partition evolution. Iceberg partitions by transforms of a column, such as days(order_ts), and each manifest records the spec its files were written with. Switch from daily to hourly and new files use the new spec while old files keep theirs; a filter on order_ts prunes both, and nothing is rewritten. Queries filter on order_ts itself and never name a partition column, which Iceberg calls hidden partitioning.
Copy-on-write versus merge-on-read
Formats also split on how a row update is written. Copy-on-write rewrites every file holding an updated row: writes pay, and reads stay plain Parquet scans. Merge-on-read writes only the change, as delete markers or small log files beside the base files, and every read merges them in until a compaction folds them back. Either way, finding the files to touch is a job of its own. Delta's MERGE starts with an inner join of the updates against the table that collects the names of the files holding a match:
from pyspark.sql import functions as F
touched = (target
.join(F.broadcast(updates), "order_id")
.select("file")
.distinct())
touched.collect()| order_id | amount | file |
|---|---|---|
| 101 | 40 | f1.parquet |
| 102 | 15.5 | f1.parquet |
| 103 | 22 | f1.parquet |
| 104 | 9 | f2.parquet |
| 105 | 60 | f2.parquet |
| 106 | 31 | f2.parquet |
| 107 | 12 | f3.parquet |
| 108 | 75 | f3.parquet |
| 109 | 18 | f3.parquet |
| 110 | 44 | f4.parquet |
| 111 | 27 | f4.parquet |
| 112 | 50 | f4.parquet |
| order_id | amount |
|---|---|
| 102 | 17.5 |
| 105 | 58 |
| 106 | 33 |
| 111 | 29 |
The join broadcasts updates, so the only shuffle is the distinct on file. The 4 changed rows hit 3 of the 4 files, and copy-on-write rewrites all 9 rows in them. Scaled up, 1,000 updated keys scattered over 200 files of 128MB each is 25.6GB rewritten for a few kilobytes of change, on every run.
Hudi was built around that trade. A record-level index maps each key to the file group holding it, a merge-on-read table appends updates to that group's log files, and compaction later merges them into a new base file. Commit times on the timeline also let a downstream job read only rows changed since the last commit it processed.
Choosing and defending it
| If the platform... | Lean toward | Because |
|---|---|---|
| Runs nearly all reads and writes on Spark, with appends and periodic merges | Delta | Simplest log, and checkpoints keep replay short |
| Shares tables across several query engines, or holds millions of files | Iceberg | Engine-neutral spec, manifests that prune at planning |
| Changes its partitioning as data grows | Iceberg | Partition evolution with no rewrite of old files |
| Upserts keyed rows every few minutes and feeds jobs that want only changes | Hudi | Record index, merge-on-read, incremental reads by commit time |
A defence names the workload, the cost the choice avoids, and the cost it accepts. For instance: 'Hudi merge-on-read, because 40 source databases upsert every 5 minutes and copy-on-write would rewrite most files each run; we accept that reads merge log files, and we run compaction hourly to keep that merge small.' Each part of it can be checked against the job's metrics.
A team runs 3 engines on the same tables: Spark writes them hourly, a SQL engine serves dashboards, and a separate service reads features for model training. The largest table holds 4 million files, rows are appended and rarely updated, and the team plans to move from daily to hourly partitions. Which format fits best?
- Delta, because the writer is Spark and the checkpoint keeps log replay short
- Hudi merge-on-read, because hourly writes need log files to stay cheap
- Iceberg, because its spec is engine-neutral, manifests prune 4 million files and partitions evolve in place
- Iceberg, because it is the only format of the 3 that accepts appends from Spark
About this lesson
This section is part of the Storage Formats: Advanced lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.