Analytics: Columns, Object Storage, Table Formats
OLTP vs analytics — same SQL, different internals
| Aspect | OLTP | Analytics (data warehouse) |
|---|---|---|
| Query pattern | Single-row lookups, small writes | Full-table scans, aggregations |
| Optimization target | Transaction processing | Query performance at scale |
| Interface | SQL | SQL |
| Internals | completely different |
HTAP (hybrid transactional/analytical) systems — SQL Server, SAP HANA, SingleStore — historically bolted two storage engines together. The modern pattern is two decoupled engines behind a common SQL interface, each optimized independently.
Cloud warehouses vs traditional
Traditional (on-premises)
Teradata, Vertica, SAP HANA. Fixed infrastructure; storage and compute tightly coupled — you scale one by scaling both.
Cloud-native (decoupled)
BigQuery, Redshift, Snowflake. Storage and compute scale independently; object storage as a cheap elastic layer; serverless pay-per-query compute; native integration with cloud streaming services.
The modern analytics stack, in four layers
- 1. Storage format — how rows become bytes: Parquet (columnar, dominant), ORC (Hive's), Lance (vector-search optimized), Nimble. Key property: persisted in object storage, readable by any engine.
- 2. Table format — immutability + ACID over those files. See below.
- 3. Data catalog — metadata and governance: which files/tables belong to a database; create/rename/drop; a standalone service with a REST API, not embedded in the engine. Snowflake Polaris, Databricks Unity Catalog, Iceberg REST Catalog. Decoupling it is what lets discovery tools inspect metadata, governance systems enforce policy, and multiple engines query the same tables.
- 4. Query engine — SQL → execution: Trino, Presto, Apache DataFusion. Parse and optimize SQL, execute as parallel distributed tasks, optionally on external executors (Spark, Flink).
Why a table format is needed at all
A raw folder of Parquet files cannot answer: which of these files are current? what did this table look like yesterday? if two writers add files simultaneously, who wins? which old files are safe to delete?
The table format is the metadata layer that answers them — tracking "what is the table right now" without ever mutating the underlying files.
Inserts are easy; deletes are where it gets interesting
✗ Copy-on-Write (default for batch)
"Delete customer #5" — who lives in part-001:
1. Read all of part-001 (1,000 rows)
2. Rewrite as part-001-v2 (999 rows)
3. metadata → [part-001-v2, part-002, ...]
4. part-001 stays until garbage collected
Reads fast (clean files).
Writes expensive — one deleted row
rewrites an entire file.✓ Merge-on-Read (default for streaming)
"Delete customer #5":
1. Write a tiny delete file:
deletes-001.parquet [customer_id=5]
2. metadata → [part-001 + deletes-001, ...]
At query time:
read part-001, apply deletes-001
→ #5 filtered out on the fly
Writes cheap. Reads pay the cost, and
delete files must be compacted back in.Either way, files are never mutated in place. Only the metadata pointer changes.
| Capability | How it works |
|---|---|
| ACID transactions | Optimistic concurrency: two writers both try to write v3; first commit wins, the loser detects the conflict and retries against v3. Both writes succeed, in sequence, with no data loss. |
| Time travel | Every metadata version is retained until garbage-collected. SELECT * FROM customers AS OF '2026-04-09' resolves to the v1 snapshot and reads only the files v1 listed. Files added later are invisible. |
| Schema evolution | Schema is tracked per snapshot, not baked into files. Old files stay readable with the new column reading null; new files include it; column mapping is resolved per-file. |
| Garbage collection | Files referenced only by expired snapshots can be deleted — after checking no live snapshot still references them. |
What's actually inside the metadata
Not one flat file — a hierarchy of small ones:
Each manifest is a catalogue of Parquet files. Per file it stores:
manifest-001.avro entry for part-001.parquet:
file_path: s3://bucket/customers/part-001.parquet
record_count: 1,000
file_size: 128 MB
column_stats:
customer_id: min=1, max=1000
signup_date: min=2024-01-01, max=2024-06-30
country: min="AU", max="US"
partition: {year=2024, month=01}
status: ADDED (or DELETED if this file was removed)Those min/max/row-count statistics are written when the Parquet file is created. They cost nothing at query time because they were computed once, during the write.
How this scales to thousands of files
The naive fear: 10,000 Parquet files → every query opens 10,000 files. What actually happens is that the engine reads the metadata hierarchy first and uses statistics to eliminate files before touching them.
SELECT * FROM customers WHERE customer_id = 5500
Step 1 — read metadata.json (1 KB, one HTTP request) → points to snapshot-v3
Step 2 — read manifest-list.avro (100 KB, one request) → 200 manifest files
Step 3 — scan manifests in memory (no data reads):
manifest-001: customer_id [1–1000] → 5500 outside range → SKIP
manifest-002: customer_id [1001–2000] → SKIP
...
manifest-055: customer_id [5001–6000] → in range → OPEN these files
manifest-056: customer_id [6001–7000] → SKIP
...
Step 4 — open 2–3 Parquet files (out of 10,000), read only the column
stripes the query needs, return matching rows.The 9,997 files that can't contain #5500 are never opened. This is file pruning, or predicate pushdown into metadata. Two mechanisms work together:
| Mechanism | How | Eliminates |
|---|---|---|
| Partition pruning | Files organized by partition (e.g. date); a query on one date skips all other partitions entirely | Entire partitions |
| Min/max statistics | Each manifest entry records column min/max; if a file's customer_id max is 1000, skip it for 5500 | Individual files within a partition |
What keeps the metadata itself from bloating? Two compaction processes — and note how exactly they rhyme with the Compaction strategies part:
Data file compaction:
1,000 × 10 MB files → 10 × 1 GB files
Fewer files = fewer manifest entries = faster metadata scans
Also improves read throughput (sequential scan of fewer, larger files)
Metadata compaction:
Periodic rewrite of manifests to drop references to deleted/expired files
Keeps manifest size proportional to LIVE file count, not historical countData compaction in Iceberg/Delta plays exactly the same role as compaction in an LSM tree (see Compaction strategies): convert many small immutable files into fewer large ones, keeping both reads and metadata management efficient. Same problem, same solution, three orders of magnitude apart in file size.
The Invariants
- Guarantees: Atomic table-level commits over a store that offers no multi-file atomicity, plus point-in-time reads of any retained snapshot — without ever mutating a data file.
- Does not guarantee: That reads stay fast as files accumulate. Metadata scan cost grows with live file count, and merge-on-read delete files must be compacted back in — both are background jobs that can fall behind, exactly as LSM compaction can.