FullStack AI Hub
Studio
lesson depth
Mastery
not started · 0%

Data Lakehouse Storage (Iceberg / Delta)

Iceberg and Delta commit immutable data files through versioned metadata, enabling snapshot reads, partition pruning, schema evolution, and time travel.

Freshness: current•15 min read•Data Engineering and Databases
Isometric Diagram LabDatabase Internals · 6 steps · 9 min

Debezium CDC & ACID Lakehouse Pipelines

Trace WAL logical replication through Kafka into snapshot-isolated Iceberg/Delta Parquet partitions.

Open Isometric Walkthrough
Full Technical Reference Document

Mental model

An Iceberg or Delta lakehouse commits data files through versioned table metadata so readers resolve a consistent snapshot while writers stage new files. Partition transforms and file statistics prune scans, and schema evolution changes the logical view without requiring every old file to be rewritten. Object storage holds the files; table metadata decides which ones belong to a committed version.

Theory

A table snapshot is a set of data files plus the metadata that describes their schema, partition layout, and statistics. Iceberg records snapshot metadata, manifest lists, and manifests; manifests index data files and their partition values. A query plans against a snapshot, then reads only files whose partition values and column bounds can match its predicates. The partition transform belongs to the table specification, so a query can filter event_ts without spelling the physical day(event_ts) directory convention.

Delta Lake uses a transaction log to define table versions. Writers stage files and propose a commit against the current log version; the log records additions, removals, metadata changes, and protocol changes. Readers replay committed log actions and can use checkpoint files to avoid replaying the entire history. Both formats separate files that happen to exist in object storage from files visible to a particular snapshot. A failed writer can leave unreferenced files, but it cannot make them visible merely by uploading them.

These formats share snapshot tables, but their metadata representations and APIs differ. Iceberg organizes metadata around snapshots, manifest lists, manifests, and table metadata JSON. Delta centers on ordered log commits and checkpoints. A catalog may coordinate name-to-metadata pointers and concurrent writers, while the table format controls snapshot interpretation. A successful object upload is not a successful table commit.

Mechanism and implementation boundary

A typical write creates data files in a staging location, computes partition values and per-file statistics, and attempts an atomic metadata commit. The commit must detect incompatible concurrent changes. If another writer changed the table after a job planned its update, the losing job needs to refresh and retry its logical operation; blindly replaying the same file additions can duplicate rows. MERGE semantics, stable record keys, and writer-specific conflict rules determine whether retries are idempotent.

Partition evolution changes where future data lands without changing the meaning of old files. An Iceberg table can move from an unpartitioned spec to a day transform and retain each spec with its files. A reader evaluates each file under the spec that wrote it. Delta commonly uses explicit partition columns, so changing a partition strategy often involves table maintenance or a replacement layout. In either format, partitioning should match stable pruning predicates, not a high-cardinality field such as a unique event ID.

Schema evolution is also a metadata contract. Adding a nullable column can leave old files without that physical field; readers synthesize its default or null according to the table semantics. Renaming must preserve field identity in the format rather than being treated as an unrelated drop and add. Type widening is safer than narrowing, but the engine, catalog, and downstream readers must agree on supported promotions.

Operational design

Suppose a 30-day event table contains 3.6 TB of compressed data, approximately 120 GB per day. A query for seven days has a partition-pruned upper bound of 840 GB. If file statistics eliminate 25% of the remaining files for a selective predicate, the estimate falls to 630 GB. This is a planning estimate, not a promise: poorly clustered values, broad predicates, tiny files, or missing statistics can erase much of the benefit.

Bscan=∑f∈F(Q)BfB_{\text{scan}}=\sum_{f \in F(Q)} B_f

Here F(Q) is the set of files not excluded by the query's partition values and usable statistics, and B_f is each selected file's compressed size in bytes. Compare this estimate with actual bytes read, planning time, files opened, and rows returned. Track commit conflicts, orphan-file growth, small-file counts, snapshot age, and maintenance duration alongside query latency.

Failure modes and misconceptions

A snapshot is not a backup. If retention removes old metadata or VACUUM deletes files still needed by a reader or time-travel query, historical reads can fail even though the latest version works. Retention periods must exceed the maximum reader duration and the recovery window required by the organization. Test cleanup against long-running readers before shortening retention.

Concurrent writers can conflict even when their input rows differ, because a table-level metadata update or overlapping partition may violate the commit protocol. A retry should reload the current snapshot, re-evaluate its predicate, and apply a stable-key operation. Reusing a staged file blindly can create duplicate records. Conversely, treating every conflict as fatal can discard safe work and cause backlog.

Metadata accumulation and file layout can degrade planning before the raw data volume becomes large. Millions of small files increase listing and manifest or log work. Compaction reduces file count but consumes I/O and can race with writers. A schema change that one engine accepts may be rejected by another reader with an older protocol implementation. Compatibility tests should cover every production engine, not only the writer.

Trade-offs

Fine partitions can reduce scanned bytes for narrow time windows, but they create more files and metadata if ingestion volume per partition is low. Coarse partitions reduce directory and manifest overhead but force broader reads. Clustering or sorting inside files can help min/max statistics, at the cost of rewriting data and delaying freshness. Choose file sizes and compaction cadence from measured ingest volume and query selectivity.

Iceberg's explicit partition specs and manifest metadata make partition evolution a first-class capability. Delta's transaction log provides a direct ordered commit history and integrates closely with its execution ecosystem. Those are different operational strengths, not interchangeable implementation details. Compare catalog behavior, engine support, conflict handling, retention semantics, and protocol upgrades against the workload you actually run.

Decision scenario

A team ingests 1.2 million events per day and serves seven-day incident queries. It wants to move from a directory-per-hour layout to a table format while keeping a 30-day time-travel window. Before enabling cleanup, measure file sizes and query pruning on representative predicates; test one writer conflict, a schema addition, and a reader held open across compaction. Keep the existing table read-only until row counts and keyed checksums match at the same snapshot boundary.

Learning outcomes

  • Trace a file from staged upload to inclusion in an Iceberg snapshot or Delta log version.
  • Estimate the scan reduction from partition pruning and file statistics, then compare it with observed bytes read.
  • Explain how partition evolution, schema changes, conflicts, and retention affect readers.

Quantitative model

For the example above, partition pruning reduces 3,600 GB to 840 GB, and 25% file elimination yields 840 GB × 0.75 = 630 GB. The model assumes file statistics can reject that fraction and does not include metadata reads or retries. Measure actual compressed bytes scanned for the same seven-day predicate and compare across table versions.

event-time predicate
partition transform projection
manifest or log snapshot selection
file-statistics pruning
columnar file scan
Conceptual teaching model synthesized from:apache-iceberg-partitioning-docs,delta-lake-docs

Implementation pattern

The following Spark SQL sketch creates comparable tables in a deployment where the Iceberg catalog and Delta extension are configured. Iceberg derives a day partition from the timestamp; Delta stores an explicit date column so the filter and physical layout are visible in the schema.

python
from pyspark.sql import SparkSession
​
spark = SparkSession.builder.appName("lakehouse-events").getOrCreate()
spark.sql("""
CREATE TABLE IF NOT EXISTS lakehouse.analytics.iceberg_events (
event_id STRING,
event_ts TIMESTAMP,
account_id STRING,
amount DECIMAL(12, 2)
) USING iceberg
PARTITIONED BY (days(event_ts))
""")
spark.sql("""
CREATE TABLE IF NOT EXISTS lakehouse.analytics.delta_events (
event_id STRING,
event_ts TIMESTAMP,
event_date DATE,
account_id STRING,
amount DECIMAL(12, 2)
) USING delta
PARTITIONED BY (event_date)
""")
iceberg_bytes = spark.sql("""
SELECT sum(file_size_in_bytes)
FROM lakehouse.analytics.iceberg_events.files
WHERE partition.event_ts_day >= DATE '2026-11-14'
AND partition.event_ts_day < DATE '2026-11-21'
""").first()[0]
print(f"Manifest-reported Iceberg file bytes: {iceberg_bytes}")
Reflect before revealing the guide

Prerequisites & Related Concepts (2)

Private notes

0 words
Recommended Free Track
Free · Verifiable Credential

FS-201Production LLM Engineer

Design an observable full-stack LLM product from capability validation through interfaces retrieval evaluation security and operations.

37 concepts~35h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.

Next