Skip to main content
Back to Academy⚡ 1. Modern Analytical Foundations
5 min read
Try Hands-on Lab
VISUAL LESSON1. Modern Analytical Foundations

OLTP vs. OLAP: Parquet & Delta Lake Columnar Mechanics

Discover why PostgreSQL stores rows together while Parquet/Delta stores columns together—and how column pruning, dictionary encoding, and min/max statistics make analytics 50x faster.

OLTP vs OLAP DatabaseApache Parquet Columnar StorageRow-Oriented vs Column-OrientedParquet Row Groups and StatisticsPredicate PushdownVectorized Query Execution

Explain Like I'm New: Grocery Receipts vs. Category Spreadsheets

Suppose your store has 10 million customers, each with 50 columns (id, name, address, phone, email, ..., annual_spend).

  • Row-Oriented Storage (`OLTP` like PostgreSQL / MySQL): Imagine printing every customer onto an index card. When a cashier updates Customer #402's phone number, grabbing 1 single card and updating it takes 1 millisecond!
  • Columnar Storage (`OLAP` like Apache Parquet / Delta Lake): Now your CEO asks: "What is the average `annual_spend` of all 10 million customers?" Reading 10 million entire index cards just to look at *1 single number* out of 50 wastes 98% of disk bandwidth! Columnar storage stores all 10 million `annual_spend` numbers packed tightly side-by-side in one strip—so the engine reads *only* 1 column and skips the other 49 completely!
Key Beginner Takeaway: OLTP databases optimize for fast single-row lookups and updates; OLAP columnar formats (Parquet/Delta) optimize for scanning 1 or 2 columns across billions of rows.

OLTP vs. OLAP Side-by-Side Comparison

DimensionOLTP (Transactional DB)OLAP (Analytical Lakehouse)
ExamplesPostgreSQL, MySQL, Oracle, SQL ServerDelta Lake (Parquet), DuckDB, Snowflake, BigQuery
Physical LayoutRow-oriented (all fields of Row 1 stored together)Column-oriented (all values of Col A stored together)
Typical WorkloadINSERT, UPDATE, point SELECT WHERE id = 5SUM, AVG, GROUP BY across 500M rows
Typical ConcurrencyThousands of users/sec touching 1–5 rowsAnalysts running deep scans across huge slices
Precision RuleStrict constraints, normalized (3NF)Denormalized Star Schemas, immutable append + MERGE

Inside an Apache Parquet File (Why It's So Fast)

A .parquet file is NOT just a list of raw columns—it uses a smart 3-layer hierarchy designed for skipping work:

  1. Row Groups (~128 MB horizontal chunks, say 1M rows each)
  2. Column Chunks (inside each Row Group, Column A sits cleanly separated from Column B)
  3. Pages + Footer Metadata (`min` / `max` / `null_count`)

Four Superpowers Unlocked by Parquet

1. Projection Pushdown (Column Pruning) If a table has **120 columns** and your query runs:

SELECT store_id, SUM(revenue)
FROM gold.pos_transactions
GROUP BY store_id;

The engine reads only 2 columns (`store_id`, `revenue`) and ignores 118 columns completely -> ~98% less disk I/O!

2. Dictionary & Run-Length Encoding (Compression Magic) If `country` repeats `'United States'` 5 million times in a row, row storage writes `'United States'` 5 million times (65 MB). Parquet creates a tiny dictionary `{0: 'United States', 1: 'Canada'}` and uses **Run-Length Encoding (`RLE`)** (`0 x 5,000,000`) -> shrinking 65 MB down to **a few kilobytes!**

3. Predicate Pushdown (Min/Max Data Skipping) Suppose Row Group 1 stores dates `2026-01-01` to `2026-01-31` and Row Group 2 stores `2026-02-01` to `2026-02-28`. When you query:

SELECT * FROM orders WHERE order_date = '2026-02-14';

Parquet checks the footer metadata first, sees Row Group 1's max = '2026-01-31', and never even decompresses Row Group 1!

4. Vectorized SIMD Execution Because all values of `revenue` sit contiguously in RAM as typed arrays (not scattered Java objects), modern CPUs (Spark Photon / DuckDB / Arrow) process 1,024–4,096 values per CPU instruction (**SIMD vectorization**) instead of looping row-by-row.


Common Beginner Mistakes (And How to Fix Them)

Mistake 1: Running `SELECT *` in Production Analytical Queries

-- BAD: Forces Parquet to read & decompress ALL 100 columns!
SELECT * FROM silver.clickstream WHERE event_date = '2026-05-01' LIMIT 100;

-- GOOD: Reads only the 3 columns you actually inspect!
SELECT user_id, page_url, event_ts
FROM silver.clickstream
WHERE event_date = '2026-05-01'
LIMIT 100;

Mistake 2: Sorting Data Wrong vs. Data Skipping Min/Max statistics only skip Row Groups if rows inside each file share a tight range (e.g. clustered by `event_date` or `tenant_id`). Random unsorted files have `min = Jan 1, max = Dec 31` in every file—defeating data skipping! Always cluster or partition by common filter columns.


Quick Cheat Sheet

  1. Use OLTP (Row storage) for apps modifying 1 row at a time (checkout, login).
  2. Use OLAP (Parquet / Delta columnar storage) for analytics scanning few columns over millions of rows.
  3. Avoid **SELECT * so Column Pruning** actually works.
  4. Keep files well-sized (128 MB–1 GB) and clustered on filter keys so Min/Max Data Skipping shines.

Comprehension & Architecture Check (3 Questions)

Test your understanding of the concepts covered in this lesson.

1. Why does dictionary encoding achieve significantly higher compression ratios on columnar formats like Parquet compared to row-oriented databases?
2. Why should beginners check a table's grain before writing a JOIN?
3. Which Medallion layer is meant to store clean, deduplicated, standardized records?
Practice What You Learned

EX-1: Delta Lake DDL & Partitioning Strategy

Global DynaDatum Bank stores account balances at the end of every month for thousands of customers. A junior engineer previously saved these balances as plain text files with no rules, which caused balance numbers to get corrupted and queries to be painfully slow. We need an official Delta Lake table that stores balance dates, money amounts, and currencies accurately. We also want queries to run fast by organizing the files by date, and prevent duplicate balance records for the same account on the same day.

Solve Challenge