DT5: Warehouse foundations

Lesson 1 of 5 · reading 15–25 minutes; practice and project time is on the module page

Why analysis needs a warehouse

🎯You'll be able to

Explain the difference between transaction databases (OLTP) and analytical stores (OLAP), and why columnar storage makes analysis fast.

🏠The everyday picture

A shop's billing counter handles one customer at a time, quickly. The accountant who studies the whole year's sales works from a different set of books, arranged so totals are easy. Mixing the two jobs at the counter would slow down every customer.

📘What it really is

📝A worked example

Input: SabziSathi's warehouse is a DuckDB file, which is a columnar store. Run explain analyze select store, sum(net_amount_paise) from marts.fct_order_lines group by 1.

Expected output: the plan shows only store and net_amount_paise being read from the 15-column table, and the whole query takes a few milliseconds for 10,181 lines. Checked on 1 November 2026 with DuckDB 2.0.0.

🌍Where it's used

📝Case scenario

An online pharmacy ran its monthly sales report on the live order database. On the first of each month, checkout slowed down for an hour while the report ran. Copying orders nightly to a warehouse moved the report off the live system, and the slowdowns stopped.

🖱️Try it

List SabziSathi's warehouse schemas and tables with select table_schema, table_name, table_type from information_schema.tables order by 1, 2. Success: you can say which schema each pipeline step writes, and which tables are views.

⚠️Common mistakes

🛠️For your project

Project 2 builds SabziSathi's warehouse layers in DuckDB; the dashboard in Project 3 reads only from it.

✅Quick check

Why is columnar storage fast for analysis?

Show the answer

A query reads only the columns it needs, and those compress well.

Why not run reports on the app's database?

Show the answer

They slow the app down, and it lacks history and other systems' data.

← BackDT5
ProLearners Assist