Iceberg's Metadata Tree

The core design principle

Every file Iceberg writes — metadata.json, manifest list, manifest, data file — is frozen once written. A commit never edits an existing file. It writes new ones and swaps a single pointer in one step. That's why a reader can never catch the table half-changed: it either holds the old pointer, and gets a complete old tree, or the new pointer, and gets a complete new tree. There's nothing in between.

The four layers, top to bottom

The metadata tree — one mutable cell at the top, immutability everywhere below
The metadata tree — one mutable cell at the top, immutability everywhere below

Layer 1 — the catalog pointer

The catalog holds exactly one changeable value per table: table name → where the current metadata.json lives. Everything below it is frozen. A commit writes its new files, then swaps this one pointer with a compare-and-swap (see Concurrency control) — "set it to the new value, but only if it still holds the old one."

That's a deliberate choice. With only one changeable thing in the whole system, "can two writers race each other?" becomes a single well-understood problem — an atomic swap on one pointer — instead of a problem every layer has to solve for itself.

Layer 2 — metadata.json

A JSON file holding the table's entire durable state at a point in time — every schema it has ever had, every partition spec, and every snapshot not yet expired:

{
  "format-version": 2,
  "table-uuid": "9c12d441-03fe-4693-9...",
  "location": "s3://warehouse/events",
  "current-schema-id": 1,
  "schemas":         [ {"schema-id": 0, "fields": [...]}, {"schema-id": 1, "fields": [...]} ],
  "partition-specs": [ {"spec-id": 0, "fields": [...]} ],
  "default-spec-id": 0,

  "current-snapshot-id": 8534680299442786500,        ← which snapshot is live RIGHT NOW

  "snapshots": [                                     ← ONE ENTRY PER RETAINED COMMIT
    {"snapshot-id": 8534680299442786499, "parent-snapshot-id": 8534680299442786498,
     "sequence-number": 40, "timestamp-ms": 1719999940000, "schema-id": 1,
     "manifest-list": "s3://.../snap-8534680299442786499-1-a4f2.avro",
     "summary": {"operation": "append", "added-data-files": "12", "added-records": "48213"}},
    {"snapshot-id": 8534680299442786500, "parent-snapshot-id": 8534680299442786499, ... }
  ],

  "snapshot-log": [ {"timestamp-ms": ..., "snapshot-id": ...}, ... ],       ← when each became current
  "metadata-log": [ {"timestamp-ms": ..., "metadata-file": ".../v7.metadata.json"}, ... ],
  "sequence-number": 41
}

Every commit writes a new metadata.json (v9, v10, …). It never edits v8. The catalog then flips its one pointer to the new file.

metadata.json has more to it than this one file's shape — what snapshots actually chains together, three histories inside it that are easy to conflate, why old versions of the file are nearly useless, how fast it grows, and what its bookkeeping fields mean. That's all gathered in metadata.json in depth later in this part, kept out of this walk so Layer 1 through Layer 4 stay four layers, not six.

Layer 3 — the manifest list

An Avro file with one row per manifest file in this snapshot. Each row records the min and max partition values across every data file inside that manifest, plus the manifest's partition_spec_id.

manifest_pathadded_filesspec_idpartitions[] summary
.../manifest-A.avro40dt: [2024-01-01, 2024-01-01]
.../manifest-B.avro90dt: [2024-01-02, 2024-01-03]
.../manifest-C.avro21dt: [2023-06-01, 2023-06-01]

That's the first level of skipping: a query for dt = '2024-01-01' throws out manifest-C without opening it, just from reading the manifest list.

Layer 4 — manifest files

Also Avro, with one row per data file. Each row holds the file's path, format, partition values, record_count and file_size_in_bytes — and the part that matters most, per-column stats: value_counts, null_value_counts, lower_bounds, upper_bounds. Those come straight from the Parquet footer when the file is written. In v2, each row also carries a sequence_number, which decides which delete files apply to it (see Compaction and maintenance).

file_pathrecordspartitioncolumn stats (user_id)
.../00000.parquet91,210dt=2024-01-01lower=4, upper=998211
.../00001.parquet88,034dt=2024-01-01lower=17, upper=997345

That's the second level of skipping: WHERE user_id = 500000 drops both files if neither [lower, upper] range covers 500000 — without opening either Parquet file. Add Parquet's own row-group stats on top, and a narrow filter can go from "millions of files" to "a handful of row groups" using metadata alone.

How lower_bounds/upper_bounds get determined Side read

No sorting is involved. The bounds come from a single streaming pass at write time: the Parquet writer keeps a running min/max per column per row group (if (v < cur) cur = v), folds row groups into the file footer at close, and Iceberg copies those footer numbers into the manifest row. One pass, O(n) per column, data order irrelevant. Same for value_counts and null_value_counts — running counters.

What "<" means is spec'd per type. The field is map<int, binary> — field-id → the value in Iceberg's single-value binary serialization (spec Appendix D). Those bytes are not byte-comparable: an int is serialized 4-byte little-endian, so 256 (00 01 00 00) would sort below 1 (01 00 00 00). A reader has to deserialize to the typed value and apply that type's comparator.

TypeOrder
booleanfalse < true
int / longsigned numeric
float / doublenumeric, -0.0 < 0.0; NaN excluded from bounds, counted separately in nan_value_counts
decimalnumeric on the unscaled value at fixed scale
date / time / timestampnumeric on the underlying days / micros since epoch
stringUTF-8 bytes, lexicographic — equals code-point order; no locale collation, no case folding
uuidunsigned lexicographic over the 16 bytes (deliberately not Java's signed UUID.compareTo)
binary / fixedunsigned byte lexicographic

Only primitive leaves get bounds. Structs recurse down to their leaves; list and map elements get none.

They're bounds, not exact min/max — deliberately. Writers may truncate, and the default is write.metadata.metrics.default = truncate(16): a 2 KB string column stores 16 characters. The lower bound is plain truncation (still ≤ every value); the upper bound is truncated and then incremented at the last code point ("abz…" → "ac") so it stays ≥ every value, and is dropped entirely if that increment overflows. So bounds are conservative — good for proving a file cannot match, never for proving a row does. Per-column modes are none / counts / truncate(N) / full, and by default only the first 100 columns get metrics at all (write.metadata.metrics.max-inferred-column-defaults) — a predicate on column 101 prunes nothing.

Where sorting actually matters. A table sort order (write.sort-order) doesn't change how bounds are computed, only how useful they are. Written unsorted, every file's [lower, upper] spans nearly the whole domain, every file overlaps every predicate, and skipping does nothing. Sorted, each file's range becomes a narrow, near-disjoint interval and one predicate touches 2 files out of 10,000. That's the whole payoff — and why compaction jobs re-sort instead of merely re-packing.

The manifest file itself also records two values in its Avro file header — key/value metadata, not per row: schema-id and partition-spec-id, whichever were current when it was written. That's how a reader knows which schema and which partition scheme apply to this manifest — more on that below.

What one commit actually creates

Day 1 — create the table, write 100 rows into data1.parquet:

FileContents
m1 (manifest)[data1.parquet]
list1 (manifest list)[m1]
v1.metadata.jsonsnapshot S1 → list1
catalog→ v1.metadata.json

Day 2 — insert more rows into data2.parquet. Iceberg does not touch m1:

FileContents
m2 (manifest, new)[data2.parquet]
list2 (manifest list, new)[m1, m2] — m1's entry copied over unchanged, m2 appended
v2.metadata.json (new)snapshots [S1, S2] — S2's parent is S1, points to list2
catalogatomically flips v1 → v2
Structural sharing — Day 2's snapshot reuses Day 1's entire subtree
Structural sharing — Day 2's snapshot reuses Day 1's entire subtree

Anyone still holding v1.metadata.json sees exactly the Day 1 table. That's all a snapshot is: a frozen manifest list, plus everything it points to, all the way down.

N data files  →  1 new manifest  →  1 new manifest list (copy + append)  →  1 new metadata.json (copy + append)  →  1 atomic pointer swap

a commit sometimes writes more than one manifest — Spark writing partitions in parallel, or a delete writing its own delete-manifest — but "one manifest per commit" is the right default picture

The other kind of commit: one that removes files

The trace above is an append — the easy case, because nothing already referenced stops being true. A commit that takes files away — compaction (see Compaction and maintenance), a DELETE, a MERGE — has to deal with the fact that a manifest is an immutable Avro file, so you can't reach in and flip two rows inside it. Worth tracing carefully, because this is where the write amplification lives.

Setup. Snapshot S1 (id 1001), whose manifest list holds four manifests of 100 data files each. Compaction rewrites 4 data files into 1: f_a, f_b live in m3, and f_c, f_d live in m4.

Only the manifests that mentioned a removed file get rewritten — the rest are pointed at again
Only the manifests that mentioned a removed file get rewritten — the rest are pointed at again

The three rules that produce that shape

RuleWhat happensWhy
1. Untouched manifests are referenced, not rewrittenm1 and m2 held none of the 4 files, so their rows in the new manifest list are straight copies — same manifest_path, same added_snapshot_id (still 1001), same counts, same partition summaries. Zero bytes of them are read or writtenThis is the structural sharing from the append case, unchanged
2. Any manifest holding a removed file is rewritten in fullIceberg streams m3 out into a new m3~: the entries for f_a and f_b come out with status DELETED and snapshot_id 1002; the other 98 entries are copied through as EXISTING. Same for m4An Avro manifest can't be edited in place. Touching 2 files means rewriting 100 entries — 196 across both manifests
3. Added files go into a brand-new manifestf_new.parquet is not appended into m3~. It gets its own m5 with a single ADDED entryRemovals and additions are handled by two separate mechanisms in the commit — a filter pass over existing manifests, and a fresh writer for new files

So the new manifest list is [m1, m2, m3~, m4~, m5]. The DELETED tombstones stay inside m3~ and m4~ so incremental and changelog scans can compute what S2 actually changed; they're dropped later, when the manifests are next rewritten or when S1 expires (this part cleanup).

What a reader of each snapshot sees

Reader on S2Reader still on S1
Manifest listsnap-1002-abc.avro, 5 rowssnap-1001-xyz.avro, 4 rows
ThenPrune rows by partition summaries, open survivors, skip DELETED entriesSame walk, over the original four manifests
Live data files100 + 100 + 98 + 98 + 1 = 397All 400 originals, every one still on disk

The S1 reader needs nothing that changed, so it costs Iceberg nothing to keep serving it. Snapshot isolation here isn't a feature that was built — it's a consequence of never mutating a file (see Schema evolution and time travel).

Cost ledger for this one commit
Read4 data files — the real I/O — plus m3 and m4
Writtenf_new.parquet, m3~, m4~, m5, the new manifest list, the new metadata.json
Untouchedm1, m2, the old manifest list, and all 400 original data files
Atomic stepExactly one — the catalog CAS from S1's metadata.json to S2's (see Concurrency control)

Everything before that last line is plain file creation: cheap, invisible, and fully retryable. If the CAS loses the race, every file written above is simply an orphan and the whole commit retries.

files removed  →  rewrite only the manifests that named them (all their other entries copied through)  +  1 new manifest for the added files  →  1 new manifest list  →  1 new metadata.json  →  1 atomic pointer swap

an append touches no existing manifest; a removal touches every manifest that mentioned a removed file, and rewrites it whole

Reading a table: the full planning trace

For SELECT * FROM events WHERE dt = '2024-01-02' AND user_id = 42:

~5 object-storage requests to plan and read — zero LIST calls
~5 object-storage requests to plan and read — zero LIST calls

About 5 requests total. The same query on a raw Hive table would need a paginated LIST of the dt=2024-01-02/ prefix and then would open every file in it, because Hive keeps no per-file stats at all.

Snapshots and sequence numbers

{
  "snapshot-id": 8534680299442786501,
  "parent-snapshot-id": 8534680299442786500,
  "sequence-number": 42,
  "timestamp-ms": 1720000000000,
  "manifest-list": "s3://.../snap-8534680299442786501.avro",
  "summary": {"operation": "append", "added-data-files": "9", "added-records": "88034"},
  "schema-id": 2
}

"Snapshot S2" isn't a copy of the table as of commit 2. It's "whatever you get by starting at S2's manifest list and following every pointer down." In the Day 1 / Day 2 example, S2's manifest list is [m1, m2], so it reuses m1 and data1.parquet as they are. The snapshot object is just a cheap root pointer that gives one whole frozen version of the table a single id.

The sequence number (format v2 and later) is a counter that goes up by one per commit, stamped onto every manifest and every data-file and delete-file entry that commit writes. Its job is to settle ordering: when a data file and a delete file both exist, the sequence number says "this delete came from a later commit than that data file, so it applies to it." Without it, a reader couldn't tell which deletes apply to which rows while commits are landing concurrently (see Compaction and maintenance).

metadata.json in depth

What "snapshots is the full commit history" actually means

Two things are true at once, and both matter:

  • Each snapshot is complete, not a delta. It doesn't say "12 files were added" as its definition of the table — it points at one manifest list that names the whole live inventory as of that commit. Reading snapshot S means starting at its manifest list and following pointers down; you never replay earlier snapshots to reconstruct it. (Delta Lake works the opposite way — see Delta's transaction log.)
  • The entries chain. parent-snapshot-id makes the array a linked list back through every commit. That chain — not the array order — is what rollback_to_snapshot, incremental/CDC reads ("what changed between A and B"), and expiry cleanup all walk.

snapshots[] entry (~0.3–1 KB of JSON)  →  1 manifest list (~1 row per manifest)  →  N manifests (~1 row per data file)  →  the data

the entry itself is tiny — all the weight lives one layer down, which is why keeping thousands of snapshots is cheap in bytes but not in commit cost

Three different histories live in metadata.json — don't conflate them

This is where most people trip. snapshots, snapshot-log, and metadata-log are three separate lists that grow at the same rate but answer different questions and are trimmed by different knobs.

FieldWhat it holdsAnswersBounded by
snapshotsThe snapshot objects themselves — id, parent, sequence number, manifest-list path, summary"Everything about version X, and how versions descend from each other"history.expire.max-snapshot-age-ms + min-snapshots-to-keep, applied only when expire_snapshots runs
snapshot-logFlat {timestamp-ms, snapshot-id} pairs — one per commit or rollback"Which version was live at 12:30?" — i.e. TIMESTAMP AS OFTrimmed alongside snapshot expiry
metadata-logPaths to previous metadata.json files — not snapshots at all"Where did the v7 file live?" — recovery and audit of the metadata files themselveswrite.metadata.previous-versions-max (default 100)

snapshots vs snapshot-log is subtle enough that it gets its own treatment later in this part — the two stop agreeing the moment you roll back.

Old metadata.json files are not on the read path

Time travel is two lookups, both inside the current file — snapshot-log → id, then snapshots → manifest list. The schema needed to interpret that old snapshot travels with it: the snapshot carries a schema-id, and every schema the table has ever had is still in the schemas array, so a column dropped two years ago is fully described under schema-id: 0. Same for spec-id on manifests. Neither array is ever trimmed — there is no retention knob for schemas or specs at all, so they accumulate for the life of the table and add to the copy-forward cost on every commit.

Don't confuse this with snapshots bloat above. snapshots grows on every commit and has a retention knob (expire_snapshots) precisely because of that. schemas and partition-specs grow only on DDL — ADD COLUMN, a rename, a re-partition — which is why there's no knob for them at all: a table doing 1,440 commits/day might still see only a handful of schema changes in its entire life, so the unbounded array stays small in practice even though nothing enforces a bound.

But note how those arrays are keyed. This is what old metadata files are actually good for:

FieldKeyed byCarries a timestamp?
snapshotsidYes — timestamp-ms per entry
snapshot-logtimeYes — that is its entire job
schemasschema-idNo — a set, not a log
partition-specsspec-idNo — a set, not a log
properties—No — one flat map, no history whatsoever

So "what did the schema look like" is fully answerable from the current file; "when did it change, and by whom" is not. The blind spot is that pure DDL creates no snapshot — ALTER TABLE … ADD COLUMN writes a new metadata.json with a new schema-id and bumps current-schema-id, but appends nothing to snapshots or snapshot-log, because no data was written. If no data commit follows for three days, that change is invisible on the timeline. Diffing v6 against v7 is the only way to place it, or to see a table property change from what to what.

That leaves old metadata files two narrow jobs: disaster recovery (current metadata.json corrupted or catalog pointer clobbered — metadata-log tells you where v7 lives so you can re-register against it), and the DDL/property audit trail above. Neither is a query feature.

How fast does this grow? Do the arithmetic

Yes — one commit produces exactly one new snapshot entry, so a job committing every minute adds 60 entries per hour. Nothing removes them on its own. With Iceberg's default 5-day snapshot retention:

1 commit/min  ×  1440 min/day  =  1,440 snapshots/day
1,440/day     ×  5 days (default max-snapshot-age-ms)  ≈  7,200 retained entries
7,200 entries ×  ~500 B each                           ≈  3–5 MB metadata.json

Five megabytes of JSON sounds harmless until you remember the copy-forward rule: every commit reads that entire file, copies the whole array, appends one entry, and writes it back out. Commit cost becomes O(retained snapshots) — it grows with your commit rate and history, not with your data. Every query planner downloads and parses the same file before it can find current-snapshot-id.

Snapshot summary — commit accounting, not file detail

Each entry in snapshots[] carries a summary: a few readable numbers about that one commit. It's what lets DESCRIBE HISTORY and system.snapshots answer without opening a single manifest.

"summary": {
  "operation": "append",
  "added-data-files": "1",
  "added-records": "48213",
  "added-files-size": "2312991",
  "changed-partition-count": "1",
  "total-data-files": "2",
  "total-records": "136247",
  "total-files-size": "4601883"
}
FieldMeaning
operationappend, overwrite, delete, or replace — what kind of commit produced this snapshot
added-data-files / deleted-data-filesFile counts changed by this commit only (the delta)
added-records / deleted-recordsRow counts changed by this commit only
changed-partition-countHow many distinct partitions this commit touched
total-data-files / total-records / total-files-sizeRunning totals for the whole table as of this snapshot — cumulative, not the delta

The two kinds of number are tied together by plain arithmetic — total-* = previous snapshot's total-* + this commit's delta — computed from two small JSON objects at commit time. Nothing is scanned. That's why a table with billions of rows can report its exact count, at any point in its history, instantly:

Previous snapshotThis commitThis snapshot
data files1added-data-files +1total-data-files 2
records88,034added-records +48,213total-records 136,247
bytes2,288,892added-files-size +2,312,991total-files-size 4,601,883

operation — four values, and replace is the one that matters

ValueMeansTypical source
appendData files added, nothing removedINSERT INTO, streaming ingest
replaceFiles swapped out, logical data unchangedrewrite_data_files (compaction), rewrite_manifests
overwriteData both added and removedMERGE, INSERT OVERWRITE, copy-on-write UPDATE
deleteData files removed onlyDELETE FROM

Compaction rewrites gigabytes of files but changes zero rows, so it's tagged replace, not overwrite. An incremental/CDC consumer walking the snapshot chain uses that tag to skip the snapshot entirely — otherwise every compaction run would look like the whole table was deleted and re-inserted, flooding downstream with spurious change records. Delta solves the identical problem with dataChange: false (see Delta's transaction log).

Schema evolution: field-ids, not names

Step 1. Day 1 — create table with id, name:

{"schema-id": 0, "fields": [
  {"id": 1, "name": "id",   "type": "long"},
  {"id": 2, "name": "name", "type": "string"}
]}

Step 2. ALTER TABLE ADD COLUMN email string — a new schema object is appended; id and name repeat unchanged:

{"schema-id": 1, "fields": [
  {"id": 1, "name": "id",    "type": "long"},
  {"id": 2, "name": "name",  "type": "string"},
  {"id": 3, "name": "email", "type": "string"}
]}

Step 3. RENAME COLUMN name TO full_name — another full copy; field id: 2 keeps its id, only the name changes:

{"schema-id": 2, "fields": [
  {"id": 1, "name": "id",        "type": "long"},
  {"id": 2, "name": "full_name", "type": "string"},
  {"id": 3, "name": "email",     "type": "string"}
]}

metadata.json now holds all three full schema objects, with current-schema-id: 2. Copying a whole schema per change is cheap, because a schema is a short list of fields — not a list of files.

Reading a Day-1 file under today's schema — three reader-side reinterpretations, zero rewrites
Reading a Day-1 file under today's schema — three reader-side reinterpretations, zero rewrites

The field-id is the one thing that never changes. A Parquet file written on Day 1 tags its second column with field-id: 2 in its footer. A query today looks up full_name in the current schema, gets field-id 2, opens that Day-1 file, and asks "what's field-id 2 in here?" It doesn't care that id 2 was called name back then. That's how one query reads files spanning years of schema changes, and why add, drop, rename, and reorder are small metadata commits no matter how big the table is.

Partition spec evolution — same pattern, different axis

Why this needs its own mechanism: in Hive-style tables the partition values live in the file path (dt=2024-01-01/user_bucket=3/part-00.parquet), so changing what you partition by means rewriting every file. Iceberg instead computes the partition value at write time with a transform function (identity, day(), bucket(N, col), truncate(N, col), …) and stores it as a proper field in the manifest entry, rather than something you parse back out of a path. Because the value sits in metadata, old files can keep the old scheme while new files use a new one in the same table — as long as every manifest remembers which scheme produced its values.

✗ Day 1 — spec 0, partitioned by day

{"spec-id": 0, "fields": [
  {"source-id": 5, "field-id": 1000,
   "transform": "day", "name": "ts_day"}
]}

✓ Day 200 — spec 1 appended, spec 0 untouched

{"spec-id": 1, "fields": [
  {"source-id": 5, "field-id": 1000,
   "transform": "day",        "name": "ts_day"},
  {"source-id": 8, "field-id": 1001,
   "transform": "bucket[16]", "name": "user_bucket"}
]}

default-spec-id flips to 1, so new writes bucket by user_id on top of partitioning by day. Manifests written before Day 200 still say partition-spec-id: 0 and carry one partition field each; manifests after say 1 and carry two. Nothing about the Day-1 files changes. The planner just has to handle both schemes when it scans a manifest list that spans the switch — which is what the per-row spec_id in Layer 3 is for.

How a manifest knows which schema/spec version applies

Where the id livesWhat it's for
manifest-list row → partition_spec_idLets the planner read that manifest's min/max partition values correctly without opening the manifest. Those bounds mean nothing until you know whether day() or bucket() produced them. It's copied here purely to keep skipping fast.
manifest's own Avro metadata → partition-spec-idThe real copy: which scheme was the default when this manifest was written. Used to read each data file's partition values.
manifest's own Avro metadata → schema-idWhich schema was current when these data files were written. Mostly record-keeping — reading columns during a scan doesn't need it, because…

…a data file doesn't need its manifest's schema-id to be read correctly. Every Parquet column carries its permanent field-id in the footer, and a query matches columns by field-id against the current schema no matter what the manifest says. The manifest's schema-id is there so tools can answer questions like "was this file written before or after email was added?", and so manifest rewrites can check they aren't mixing incompatible files.

1. Read manifest-list row for manifest-C → partition_spec_id: 1
2. Look up metadata.json → partition-specs[1] → fields: [day(ts), bucket[16](user_id)]
3. Now the planner can interpret manifest-C's partition summary — and, if not
   pruned, open manifest-C and decode each file's partition struct with spec 1
4. For column pruning inside those files: ignore spec/schema-id entirely.
   Match requested column names → field-ids in the CURRENT schema, and look
   those field-ids up directly in each Parquet file's footer stats.

spec-id tells you how to read a manifest's partition values · schema-id just records where a file came from · field-id is what actually finds columns during a scan. Because field-ids never change, steps 1–3 aren't needed to read columns correctly at all.

snapshot-log vs snapshots

The two stop agreeing the moment you roll back, because a rollback moves the "current" pointer without changing the family tree:

TimeEventsnapshots (DAG)current-snapshot-idsnapshot-log record appended
10:00insert[S1]S1{10:00, S1}
11:00insert[S1, S2] (parent S2 = S1)S2{11:00, S2}
12:00bad write[S1, S2, S3] (parent S3 = S2)S3{12:00, S3}
13:00rollback_to_snapshot(S2)[S1, S2, S3] — unchangedS2{13:00, S2} ← repeats an old id
14:00new insert[S1, S2, S3, S4] (parent S4 = S2, not S3)S4{14:00, S4}
  • Rollback never touches snapshots. S3 isn't deleted; it stays valid and readable until expire_snapshots cleans it up. snapshots only grows when a new snapshot is created.
  • snapshot-log is the only place the back-and-forth path S1 → S2 → S3 → S2 → S4 is recorded. Adding an entry doesn't mean the snapshot-id inside it is new. {13:00, S2} is a new record about an old snapshot; what's new is the fact that S2 became current again at 13:00.

That's why SELECT * FROM t TIMESTAMP AS OF '12:30' needs snapshot-log. It scans the log for the last entry at or before 12:30, finds {12:00, S3}, and reads S3's manifest list. snapshots can tell you S3 existed and that its parent was S2, but it can't tell you S3 was the live table between 12:00 and 13:00. Once rollbacks exist, "who descends from whom" and "what was current when" are two different questions.

Why you still need snapshots after the log gives you an id

A log entry is just {timestamp-ms, snapshot-id}. It holds an id and nothing else — no pointer to a manifest list. So a time-travel read always takes two lookups:

1. Walk snapshot-log → last entry ≤ 13:00 → {13:00, S2}     (an id. nothing else.)
2. Look up S2 in snapshots[]              → the actual object:
     {"snapshot-id": S2, "parent-snapshot-id": S1,
      "manifest-list": "s3://.../snap-S2....avro", "sequence-number": 2, ...}
3. Follow manifest-list → manifests → data files

Think of it as an index and a table: snapshot-log is an index on time, and snapshots is the table of records it points into. An index entry with no row behind it is useless.

CapabilityNeedsWhy snapshot-log alone can't do it
Time travel (TIMESTAMP AS OF)log → id, then snapshots → manifest-listLog gives the id; only snapshots has the pointer
Version travel (VERSION AS OF id)snapshots onlyNo timestamp involved — skips the log entirely
Incremental / CDC readswalk parent-snapshot-id from B back to AThe log is a flat timeline with no parent links, so it can't say which commits sit between two ids
expire_snapshots cleanupwalking the graph of parent-snapshot-id links"Is anything still pointing at this file?" is a question about ancestry; the log only records what was current when
rollback_to_snapshot checksconfirm the target id still existsThe log can mention an id again without proving that snapshot is still around

Short version: snapshot-log answers "which id was current at time T." snapshots answers "everything about that id" — its manifest list, its parent, its summary — plus the family tree that CDC reads, cleanup, and rollback all need, and that a flat list of timestamps was never meant to hold.

Dropping snapshots: expire_snapshots and cleanup

Use caseWhy it needs old snapshots kept
Time travelExplicit user-facing historical read
RollbackYou can only roll back to a snapshot that still exists
Incremental / CDC readsstart-snapshot-id=A, end-snapshot-id=B sends only what changed between A and B downstream, which needs the parent chain between them intact
Consistent long readsA long query locks onto one snapshot when it starts, and that tree has to stay valid until it finishes. Writers use the same mechanism to check their starting snapshot at commit time (see Concurrency control)

"Same mechanism" here means pinning to a snapshot-id as a fixed reference point, not just an analogy. A long reader records "I'm on S8" and keeps following S8's manifest list for the life of the query, however long that takes. A writer does the identical thing before it touches the catalog — step 1 of the Concurrency control commit protocol is "reads metadata.json v8, notes current-snapshot-id = S8" — then builds its whole change against that pinned snapshot and CASes on "is S8 still current?" Both are just consumers of the same underlying guarantee: once a snapshot's tree exists, it never changes underneath you, it only ever gets read from or eventually expired.

The retention knobs — and the fact that none of them fire by themselves

These are table properties, set with ALTER TABLE ... SET TBLPROPERTIES. The critical thing: with the exception of delete-after-commit.enabled, they are policy read by a maintenance job, not a background daemon. Set them all you like — if nobody calls expire_snapshots, nothing is ever dropped.

PropertyDefaultWhat it controls
history.expire.max-snapshot-age-ms432000000 (5 days)How far back snapshots entries are kept — and therefore your entire time-travel window
history.expire.min-snapshots-to-keep1Floor that overrides age. Keeps a table that hasn't been written to in a month from being stripped down to nothing
write.metadata.previous-versions-max100Length of metadata-log — how many old metadata.json paths are tracked. Unrelated to snapshots
write.metadata.delete-after-commit.enabledfalseThe one that does act automatically. Left off (the default), superseded vN.metadata.json files accumulate as objects in the bucket forever, even after they fall off metadata-log
CALL catalog.system.expire_snapshots(
  table      => 'db.events',
  older_than => TIMESTAMP '2026-08-04 00:00:00',
  retain_last => 100
);

Retention window and time-travel window are the same knob. expire_snapshots physically deletes the manifest lists, manifests, and data files that no surviving snapshot references — so you cannot query as-of a snapshot you expired. Choose the number from what your consumers actually read, then treat it as a hard floor.

When does cleanup actually free anything?

This one is easy to get wrong. On a table that only ever appends, nothing ever becomes unreferenced. Each new manifest list carries the old entries forward — list2 = [m1, m2] keeps m1 alive forever. So on an append-only table, expire_snapshots frees only the superseded metadata.json files and superseded manifest lists. Never manifests, never data files.

A file only becomes unreferenced when a later commit takes it out of the live set: a delete, an overwrite, or compaction. Those are the only commits whose new manifest list drops an old entry instead of copying it forward.

StepWhat happensManifest list of that snapshot
Day 1: insert batch Am1 = [data_A]list1 = [m1] → S1
Day 2: insert batch Bm2 = [data_B]list2 = [m1, m2] → S2 (pure append — data_A carried forward)
Day 3: DELETE all of batch Awrites m3 that excludes data_Alist3 = [m2] → S3 — first snapshot where data_A leaves the live tree

S3 no longer points at data_A.parquet, but S1 and S2 still do, and both are still in the snapshots array — which is exactly what a rollback or a "as of Day 1" query needs. The file stays on disk: wasted space from today's query's point of view, kept on purpose. Only when expire_snapshots drops S1 and S2 do data_A, m1, list1, and list2 lose their last reference.

That's why compaction and expire_snapshots are always scheduled as a pair. rewrite_data_files takes the old small files out of the current snapshot; expire_snapshots is what actually frees the disk. Compaction alone never deletes a byte.

How cleanup decides what to delete: sets, not ownership tags

You might expect a manifest list to mark which manifests this snapshot added versus which it inherited. It doesn't. Old entries are simply copied forward, with nothing recording which snapshot first wrote them. Instead, cleanup works out what's still referenced from scratch, using two sets.

Take the rollback example: S1 → S2 → S3 where S3 was a bad write, roll back to S2, then S4 branches off S2.

Retain {S1, S2, S4}, expire {S3} — m3 is the only garbage, even though m1/m2 were also in S3's list
Retain {S1, S2, S4}, expire {S3} — m3 is the only garbage, even though m1/m2 were also in S3's list

Step 1. Still referenced — every manifest named by a snapshot you're keeping:

keeping = {m1} ∪ {m1, m2} ∪ {m1, m2, m4} = {m1, m2, m4}

Step 2. Everything seen — every manifest named by any snapshot still present, including the one being expired (its list gets read one last time before its entry goes away):

all = {m1} ∪ {m1, m2} ∪ {m1, m2, m3} ∪ {m1, m2, m4} = {m1, m2, m3, m4}

Step 3. Delete what's left over: all − keeping = {m3}. Drop m3, then run the same two-set comparison one layer down for data files.

This retain/expire split isn't something older_than can produce. older_than is a single age cutoff — it always drops a contiguous prefix by time, so it can never keep S1/S2 (older) while dropping S3 (younger, sitting between S2 and S4). Getting exactly "expire the bad snapshot, keep everything else" requires targeting it directly: expire_snapshots(table => '...', snapshot_ids => array(S3_id)). That works on any snapshot regardless of age relative to what you're retaining — the one snapshot you can never target this way is whichever one current-snapshot-id points to.

Notice what happens to m1 and m2. They appear in four manifest lists, including the one being expired, and they survive — because all that matters is whether something you're keeping still points at them. Nothing ever needed to know "m1 belongs to S1," only "m1 is still pointed at by something alive." Same rule git uses.

Format v1 vs v2 vs v3

v1 (2017)v2 (2021+)v3 (2025+)
Row-level deletesNot supported — a delete rewrites entire data files (copy-on-write only)Supported via delete files (positional or equality) — merge-on-read, no full rewritePositional deletes become deletion vectors: one bitmap per data file, stored in a Puffin file — the same shape as Delta's (see Compaction and maintenance). Equality deletes are unchanged
Sequence numbersNot presentPresent — required to order delete files against data filesSame as v2
Row lineageNoNoYes — every row carries a _row_id and _last_updated_sequence_number, so a CDC consumer can follow one row across rewrites
Types and defaultsFixed set of primitives; a newly added column is always null for old rowsAdds variant, geometry/geography, nanosecond timestamps, and default values for rows written before an ADD COLUMN

v2 is what made Iceberg workable for CDC and streaming upserts, by removing the need to rewrite whole files for every update (see Compaction and maintenance). v3 mostly closes the remaining gap to Delta — deletion vectors and row lineage — and adds the semi-structured types warehouses had and open formats didn't. Engine support for v3 is still uneven, so check every reader before bumping a shared table (see Catalogs and engine interop).

The Invariants

  • Guarantees: Once a reader has a metadata.json location, everything it points to is complete and consistent — every manifest and data file exists, because nothing gets referenced until the commit that added it succeeded. Old snapshots stay readable until you expire them. Schema changes are tracked by field ID, never by name or position.
  • Does not guarantee: It doesn't guarantee your commit wins against other writers. That race happens at the catalog (see Concurrency control) and your write can still lose and have to retry. It also doesn't stop metadata from piling up: every commit adds a manifest list and usually new manifests, so planning gets slower as commits accumulate, not just as data grows (see Compaction and maintenance).