SysDesignAtlas

Data Lakes, Lakehouses & Batch Processing

Parquet, table formats like Iceberg, partitioning that actually helps, and why the industry converged on "object storage plus metadata" for everything analytical.

HLDMedium13 min readdatabatchparqueticeberg
Confidence

#Why not just use a database

An analytical warehouse works well until one of three things happens:

  1. The data outgrows what you'll pay for. In a traditional warehouse, the machines that store your data are the same machines that query it, so you pay for both together. A petabyte you touch once a quarter costs the same per byte as the table you hit every second.
  2. The data isn't tabular. Images, audio, model checkpoints, raw JSON, logs. A warehouse will take these grudgingly and expensively.
  3. Many engines need the same data. SQL, Spark, a training pipeline, and a notebook all want the same table without copying it four times.

The answer the industry converged on is to separate storage from compute and from the table definition:

Query engines Spark · Trino · DuckDB · training jobs Table format Iceberg / Delta / Hudi — schema, snapshots, ACID File format Parquet / ORC — columnar, compressed, statistics Object storage S3 / GCS — cheap, durable, infinitely scalable
Each layer is independently replaceable. That's the whole point.

Any engine can be swapped without moving data. Storage costs cents per gigabyte-month. Compute is rented only while a query runs. That combination is why this architecture won.

#Parquet: why columnar files are so much faster

A Parquet file is split into row groups — horizontal slices of, say, a million rows each. Inside each row group, data is stored column by column, and statistics (min, max, null count) are attached at every level.

   PARQUET FILE
   ├── Row group 1  (~128 MB of rows)
   │   ├── Column "user_id"    [pages] + min/max/nulls/count
   │   ├── Column "country"    [pages] + min/max + dictionary
   │   └── Column "amount"     [pages] + min/max
   ├── Row group 2 ...
   └── Footer: schema + statistics for every column of every row group

   Query:  SELECT amount FROM t WHERE country = 'IN'

     1. Read the footer only (a few KB)
     2. Skip every row group whose country min/max excludes 'IN'
     3. In surviving groups, read ONLY the country and amount columns
     4. Never touch the other 47 columns

Three separate wins compound here:

  • Column pruning. Reading 2 of 50 columns reads ~4% of the bytes.
  • Predicate pushdown via statistics. Min/max per row group skips whole chunks without decompressing them.
  • Compression that actually works. A column holds one type with similar values, so dictionary encoding, run-length encoding, and delta encoding (storing each value as the small difference from the previous one — ideal for sorted timestamps) all apply. 5–10× compression on real data is typical, versus ~2× for row-oriented JSON.

Combined with vectorized execution, this is why a scan over a Parquet dataset can beat a row-store by two orders of magnitude on the same hardware. The mechanism is entirely covered by columnar storage — Parquet is that idea serialised to a file.

#Partitioning: the highest-leverage decision

Partitioning stores rows in different directory paths by column value, so the engine can skip entire directories.

   s3://lake/events/
     dt=2026-08-01/hour=00/part-0000.parquet
     dt=2026-08-01/hour=01/part-0000.parquet
     ...

   WHERE dt = '2026-08-08'  → reads 1 day instead of 3 years

The rules that matter:

  • Partition on what you filter by, almost always time. If most queries are "last 7 days", partitioning by date is the single biggest win available.
  • Don't over-partition. Partitioning by user_id with 10 million users creates 10 million directories with tiny files in each — you've built the small-file problem deliberately.
  • Aim for 100 MB – 1 GB per partition. If a day's data is 10 KB, partition by month.
  • Beware skew. Partitioning by country puts 60% of rows in one directory, and one task processes it while the others idle.

#Table formats: giving a pile of files ACID

A folder full of data files is not a table. Nothing says which files are current, nothing lets you add and remove files as one indivisible change, nothing gives a reader a stable view while a writer is midway through appending, and nothing tracks how the columns have changed over time.

A table format adds a thin layer of bookkeeping on top of those files that supplies exactly those missing pieces — a list of which files make up the table right now, and a rule for swapping that list atomically:

   ICEBERG
     catalog → current metadata pointer
                  ↓
              metadata file  (schema, partition spec, snapshot list)
                  ↓
              manifest list  (which manifests belong to this snapshot)
                  ↓
              manifests      (which data files, with per-file statistics)
                  ↓
              Parquet files

   A COMMIT is a single atomic swap of the catalog pointer.
   Readers holding the old pointer keep seeing a consistent old snapshot.

Read it top to bottom. The catalog is a small service (or database table) that stores one thing per table: which metadata file is current. Everything below it is an immutable file in object storage. A writer adds new Parquet files and new metadata files describing them, then asks the catalog to swap the pointer to the new metadata file — "only if it still points where I last saw it". If another writer got there first, the swap fails and the writer retries. Until the swap, nobody can see the new files.

That one atomic pointer swap delivers:

CapabilityHow it worksWhy you care
Atomic commitsPointer swap; readers never see partial writesConcurrent readers and writers stop corrupting each other
Snapshot isolationEach reader pins a snapshot for its whole queryA long query gets consistent results while ingest continues
Time travelOld snapshots retainedAS OF '2026-08-01' — reproduce a report or a training set exactly
Schema evolutionColumns tracked by ID, not positionAdd, drop, rename, reorder without rewriting data
Row-level deletesDelete files or copy-on-write rewritesGDPR erasure, CDC merge, corrections
File pruningPer-file statistics in the manifestsSkip files without opening them

The two styles of row-level delete trade write cost for read cost. Copy-on-write rewrites every data file that contains a deleted row — slow to delete, but reads stay simple. Merge-on-read writes a small "delete file" listing which rows are gone, and every reader filters them out on the fly — fast to delete, slightly slower to read until compaction folds the deletes in.

The three contenders — Iceberg, Delta Lake, Hudi — differ less than the discourse suggests. Iceberg has the broadest engine-neutral adoption; Delta is strongest inside the Databricks ecosystem; Hudi was built around incremental upserts and still leads there. For a new project without an existing platform commitment, Iceberg is the safe default.

The formats are also converging:

  • Databricks bought Tabular — the company founded by Iceberg's creators — in 2024.
  • Delta can publish Iceberg metadata for the same files (UniForm), so one copy of the data is readable as either format.
  • Iceberg's v3 spec (2025) adopted Delta-style deletion vectors (a compact bitmap per file marking which rows are deleted) and a semi-structured variant type for JSON-like data.
  • The clouds now sell managed Iceberg tables outright. Amazon S3 Tables (December 2024) runs compaction and snapshot expiry (deleting old snapshots and the files only they referenced) for you — the two maintenance jobs whose neglect is the most common way a lakehouse rots.

The same shape — immutable files plus one atomically swapped pointer — now sits under whole databases, queues and search engines that keep nothing on local disk; see databases on object storage.

#Batch processing over it

With storage solved, batch compute is comparatively simple: read files, transform, write files.

The shuffle is the only part that's hard. Any operation that regroups data by key — join, group-by, sort — requires moving records across the network so that all records with the same key land on the same task.

   SHUFFLE

   M map tasks partition their output by hash(key) % N
     → written to local disk
   N reduce tasks each fetch their partition from every map task
     → M × N network transfers

   Costs: disk write + network + disk read + often a sort

   → The shuffle is where batch jobs spend most of their time
     and where they fail. Everything else is embarrassingly parallel.

"Embarrassingly parallel" means each task can work on its own slice of files with no need to talk to any other task — so adding machines speeds it up almost perfectly. The shuffle is the one step where tasks depend on each other.

The two failure modes worth knowing:

  • Skew. One key holds 40% of the rows, so one task runs for an hour while 999 finish in a minute. Fixes: salt the hot key — turn IN into IN#0 … IN#9 by appending a random suffix, so its rows spread over 10 tasks; aggregate each piece, then combine the 10 partial results in a second, small stage. Or broadcast the small side of the join so there's no shuffle at all.
  • Spill. A task's partition doesn't fit in memory and goes to disk. Fixes: more partitions, so each is smaller.

Avoid shuffles where you can. A broadcast join — replicating a small table to every task — eliminates the shuffle entirely and is often 10× faster. Pre-partitioning ("bucketing") a table by its join key means a later join can skip the shuffle too.

#Batch, streaming, or both

The old Lambda architecture ran a batch pipeline for correctness and a parallel streaming pipeline for freshness, then merged them at query time. It worked, and it meant writing and maintaining every piece of business logic twice, in two systems, with two sets of bugs.

Kappa proposed one streaming pipeline, with reprocessing done by replaying the log from the beginning. Cleaner in principle; the constraint is that your log must retain enough history to replay, which for years of data means it's really object storage again.

Where it actually landed is neither: one table format, two access patterns. Streaming ingest appends to an Iceberg/Delta table; batch jobs and interactive queries read the same table; a compaction job keeps the file sizes sane; corrections are applied as row-level updates. One copy of the data, one schema, one set of business logic, and freshness measured in minutes rather than hours.

#Check yourself

Name the four layers of a lakehouse.Show answer
Object storage (cheap, durable), a columnar file format (Parquet), a table format (Iceberg, Delta, Hudi) and interchangeable query engines — each replaceable without moving data.
What three wins compound in Parquet?Show answer
Column pruning (read only needed columns), predicate pushdown using per-row-group min/max statistics, and 5–10× compression from homogeneous columns.
Why do small files ruin a lakehouse, and what's the fix?Show answer
Each object request costs about 20–100 ms, so 500,000 small files spend the query on request overhead and listing. Target 128 MB–1 GB per file and run compaction as a scheduled, first-class job.
What are the partitioning rules?Show answer
Partition by what you filter on (usually time), aim for 100 MB–1 GB per partition, don't partition high-cardinality columns like user_id, and watch for skew.
What is Iceberg's hidden partitioning?Show answer
The table declares a transform such as days(event_time), and the engine prunes from predicates on the natural column. Users needn't know the layout, and the scheme can change without rewriting old data.
How does a table format give a pile of files ACID?Show answer
Metadata lists exactly which files form each snapshot, and a commit is one atomic swap of the catalog pointer. Readers pin a snapshot, giving isolation, time travel and safe concurrent writes.
Why does time travel matter?Show answer
Reproducibility — retrain on exactly the data as of a date, roll back a bad ingest by repointing, diff snapshots, and audit what a report was computed from.
Why is the shuffle the hard part of batch jobs, and how do you avoid it?Show answer
Group-bys, joins and sorts must move every record across the network to the task owning its key, paying disk, network and often a sort; skew and spills strike there. Broadcast small tables and pre-bucket by join key.

#What to carry forward

  • Object storage + file format + table format + engine — four independently replaceable layers.
  • Parquet wins three ways at once: column pruning, statistics-based skipping, and compression that works because columns are homogeneous.
  • Small files are the primary failure mode. Compaction is a required component, not an optimisation.
  • Partition on your filter column, usually time. 100 MB – 1 GB per partition; watch for skew.
  • Table formats add atomic commits, snapshot isolation, time travel, and schema evolution through one atomic pointer swap.
  • The shuffle is where batch jobs spend their time and die. Broadcast joins and pre-bucketing avoid it.
00:00
/ 13m