lab: connecting…
Data Architecture · Intro session

Where does your
data live?

A 30-minute tour of the modern data stack, then one deep dive: how storage layout decides speed, cost and what is even possible.

RedisPostgresDuckDBS3 + Parquet

Press S for speaker view · Esc for overview

Run of show · 30 min

What we'll cover

Map 3'
Four stores 3'
Which store? 3'
Deep dive 5'
Live demo 9'
Quiz 4'
1 · The mapThe whole data architecture on one page, mapped to the 24-session course.
2 · Four storesRedis, Postgres, DuckDB, S3: what each is, how it lays data out, where it shines.
3 · Which store?Speed vs cost, then four real scenarios to check yourself.
4 · Deep diveRow vs columnar: how the same table is laid out on disk, and why that decides speed and cost.
5 · Live demoThe same 5M orders in all four engines. We compare their sizes, then race six workloads.
6 · Cheat-sheet + quizOne table to remember, then six questions.
1 · The map

The whole data architecture on one page

🧾

Sources

Where data is born

App databases · SaaS APIs · event streams · files
S10 Data contracts
›
🚚

Ingestion

Move it in

Batch ELT · log-based CDC · Kafka
S11 · S12
›
TODAY
🪣

Storage

Keep it cheap and durable

S3 / GCS · Parquet / ORC / Avro · Iceberg / Delta
S1 · S2 · S4
›
DEMO
⚙️

Compute & modeling

Shape it

Snowflake · BigQuery · Spark · DuckDB · dbt
S3 · S5 – S8
›
DEMO
⚡

Serving

Make it fast to ask

Redis · ClickHouse / Pinot · semantic layer · reverse ETL
S13 – S15
›
📈

Consumption

Use it

BI · apps · ML · RAG / vector search
S21 AI data
Orchestration S9
Governance & security S19
Observability S20
FinOps S18
CI/CD · IaC S16 · S17
Capstone · S22 design the whole thing → S23 review cost & governance → S24 defend it
2 · Four stores

Meet the four stores we'll compare

Redis

In-memory key → value
session:42→{cart…}user:7→{…}hits:home→1,204
Great sub-ms reads · key expiry (TTL) · counters
Weak RAM is expensive · no ad-hoc queries
Sessions · caches · rate limits · leaderboards

Postgres

Row-oriented relational (OLTP)
Great ACID transactions · indexes · fast updates
Weak scanning wide tables for analytics
System of record · app backends · orders · profiles

DuckDB / OLAP

Columnar analytical engine
Great scans · aggregations · compression · SQL on files
Weak single-row updates · many small writes
Analytics · BI · warehouses · embedded / laptop

S3 + Parquet

Object storage + open file format
📁 raw/📁 orders/▤ part-0.parquet▤ part-1.parquet
Great cheapest durable bytes · infinite scale · decoupled compute
Weak high first-byte latency · immutable files
Data lake · landing zone · archives · history

Same data can live in all four, each answers a different question well.

3 · Which store?

Every store trades speed against cost

Order-of-magnitude, storage-only list prices (us-east-1 style). Log scale: RAM costs hundreds of times more per byte than object storage.

3 · Which store? · check yourself

Four scenarios, four different answers

🛒 Shopping-cart sessions
expire in 30 min, read on every page view
→
Redis
in-memory + native TTL: sub-ms reads, auto-expiry
👤 Customer profiles
edited by the app, read by ID, never lose a write
→
Postgres
ACID, all fields of a row together, indexed by key
📊 5 years of orders
finance asks a new SUM / GROUP BY every week
→
DuckDB / columnar OLAP
reads only the columns it needs, compresses them
🗄️ 50 TB of raw clickstream logs
queried maybe once a month
→
S3 + Parquet
cheapest durable bytes; spin up an engine only when needed

"Just use Postgres" would have been wrong three times out of four.

4 · Deep dive · Session 2 · File formats & storage strategy

Same table. Two ways to lay it on disk.

The logical table

Each coloured block below is one value. Highlighted = the bytes a query must read.

A · get order #5 (one whole row)

B · SUM(amount) (one column, every row)

Row store wins when you want a whole record · column store wins when you want a few columns of many records, and each column compresses far better (same type, repeated values).

4 · Deep dive · anatomy of a Parquet file

Parquet = row groups → column chunks → footer

ROW GROUP 0 · rows 1 – 122,880
order_idcustcategoryamountstatus…
ROW GROUP 1 · rows 122,881 – 245,760
order_idcustcategoryamountstatus…
… 41 row groups for 5M rows

The footer of our real 5M-row file

row groupcolumnminmaxbytes (zstd)
0order_id1122,880162,139
0statuscancelledshipped26,173
1order_id122,881245,760124,817

order_id ranges never overlap → the engine can skip whole row groups. status has the same min/max everywhere → useless for skipping.

We'll open this footer live in the demo.

4 · Deep dive · skipping data (predicate pushdown)

One filter skips 40 of 41 row groups. Another skips none.

WHERE order_id = 4,200,000

Footer says only one row group's range contains it → 1 of 41 read. Measured locally ≈ 6 ms.

WHERE customer_id = 4242

Every row group's range spans 1 – 200,000 → 41 of 41 read. Measured locally ≈ 12 ms.

Sort or cluster data by the column you filter on most. Locally the gap is only ~2× because fixed HTTP overhead dominates; on real S3 every skipped row group is a skipped network request, so the gap grows with latency and data size. (Same idea as clustering keys in Snowflake / BigQuery, Session 3.)

4 · Deep dive · partitioning & formats

Partition by what you filter, not by what you have

s3://lake/orders_by_month/ ├─ order_year=2024/ (12 folders) └─ order_year=2025/ ├─ order_month=1/ part.parquet ├─ … ├─ order_month=6/ part.parquet ◀ the only file opened └─ order_month=12/ part.parquet

WHERE order_year=2025 AND order_month=6 → 1 file read.
No filter → 24 files read. The cheapest query is the one that never touches the data.

✓ order_year / order_month
24 folders · matches the filter · similar sizes
✕ customer_id
200,000 folders of ~25 rows → the small-files problem: listing and opening files costs more than reading data
⚠ country
IN holds 17% of rows, BR only 5% → skew: one partition 3× its peers, one worker still busy while the rest idle
ParquetORCAvro
Layoutcolumnarcolumnarrow
Best foranalytics, lakesHive / Hadoopstreaming, Kafka
5 · Live demo · 9 min

Same 5,000,000 orders. Four homes.

Row store pays for indexes and per-row overhead · columnar stores compress by column · Redis pays RAM prices for every byte.

5 · Live demo · the race
5 · Live demo · Parquet X-ray

Open the file we just talked about

Bucket console: localhost:9001 (minioadmin / minioadmin) to show the folders.

6 · Cheat-sheet

Pick the store by the access pattern

●●● best fit · ●● workable · ● painful · ✕ wrong tool. Green = the winner for that need.

7 · Quiz
Wrap-up

Three things to remember

  • ① Layout is architecture. Row vs column, sort order and partitioning decide speed and cost, before any tuning.
  • ② One store never fits all. Hot → RAM, transactional → row store, analytical → columnar, everything else → cheap object storage.
  • ③ The cheapest query touches the least data. Skip with stats, prune with partitions, project only the columns you need.

Where this goes in the 24-session course

S1–2 · Storagecloud storage, formats, partitioning ← today
S3–6 · Computewarehouses, lakehouse, Spark, DuckDB
S7–10 · Modelingdimensional, wide tables, DAGs, contracts
S11–15 · Move & serveCDC, streaming, real-time OLAP, semantics
S16–21 · OperateCI/CD, IaC, FinOps, governance, observability, AI
S22–24 · Capstonedesign · review · defend

Student notes (Google Doc) have everything on these slides plus the demo queries.