Data Warehousing & Lakes
Separate analytical OLAP queries from live OLTP traffic using columnar storage and ETL/ELT.
In plain words
A data warehouse is a big, organized store built for analysis and reports. A data lake is a cheaper place to dump raw data of any kind for later use.
Think of it like…
Live checkout registers (OLTP) record each receipt quickly; end-of-day accounting ledgers (OLAP) summarize columns across the entire year.
Where you’ve seen it
Every night, Uber copies trip data into a warehouse so analysts can answer questions like "which cities grew fastest this month?" without slowing the live app.
Words you’ll hear
- OLTP vs OLAP
- OLTP serves live app traffic; OLAP runs big analytical queries.
- ETL / ELT
- Extract, transform, load: moving data from apps into the warehouse.
- Columnar storage
- Storing data by column so summing one column is very fast.
- Data lake
- Cheap storage (like S3) holding raw files in many formats.
Visual diagram
Theory & deep dive
Row-oriented OLTP vs. Column-oriented OLAP
Your live application database (OLTP) fetches one customer order at a time (SELECT * WHERE id=55), so storing all fields of one row together on disk is super fast.
An analytics report (SELECT AVG(price) FROM orders WHERE year=2026 over 2 billion rows) only needs 2 columns out of 50! A columnar store (Parquet, BigQuery, Snowflake, ClickHouse) stores each column contiguously on disk - skipping the other 48 columns and compressing repeated values by 10×.
GROUP BY analytics over billions of rows on your live OLTP production database.How it works, step by step
Step 1 of 41. Capture events & DB changes asynchronously
Stream clickstreams via Kafka and database changes via CDC into object storage or staging tables without querying live OLTP tables directly.
- Transport
- Kafka / Firehose
- DB Capture
- CDC (Debezium)
When to use it & trade-offs
What it is
Data warehouses and lakes store historical events in column-oriented formats (like Parquet) for fast aggregations across billions of rows without impacting production OLTP databases.
Why it matters: Running SELECT AVG(price) GROUP BY country over 500M rows on your live checkout database locks pages and degrades user latency.
When to reach for it
- Clickstream analytics, ad impression counting, billing rollups, and BI dashboards
- Training ML models on years of historical events without touching OLTP
- Real-time OLAP (ClickHouse / Druid / Pinot) for sub-second user-facing analytics
When to avoid or be careful
- Pointing Tableau/Looker directly at your production primary OLTP database
- Writing thousands of tiny 5 KB Parquet files per minute without compaction
OLTP vs. OLAP vs. Data Lakehouse
Strengths: Row-oriented layout updates single records in milliseconds with ACID.
Watch out: Scanning millions of rows for analytics thrashes I/O and cache.
Strengths: Columnar vectorized execution, separation of compute & storage.
Watch out: Not meant for high-QPS single-row updates or <10 ms user-facing reads.
Strengths: Cheap object storage with ACID transactions, schema evolution, and time travel.
Watch out: Requires managing compaction (small-files problem) and query engines.
Interview signals & numbers to know
When this topic comes up
- analytics dashboard
- clickstream
- petabyte logs
- reporting queries
- OLAP
Benchmarks & rules of thumb
- Parquet compression vs JSON
- 5–15× smaller
- Ideal Parquet file size
- 128 MB – 1 GB
- OLTP target latency
- <20 ms
- OLAP query latency
- 100 ms – 10s
Common mistakes & follow-ups
Common interview mistakes
- Creating the “small files problem” by flushing tiny files every second to S3 without compaction
- Running heavy
SELECT *queries on columnar warehouses (defeats column pruning and spikes cost) - Using row-oriented DBs for billion-row time-range aggregations
Likely interviewer follow-ups
- Why are columnar formats like Parquet vastly faster than row-based storage for
SUM(amount)? - What is the “small files problem” in data lakes and how do Iceberg/Delta fix it?
- When would you pick ClickHouse/Pinot over Snowflake or BigQuery?
Knowledge check
Put it into practice
Design full architectures with AI feedback
Apply Data Warehousing & Lakes inside real High-Level Design prompts or review Q&A flashcards.