Module 06 • Enterprise Business Intelligence

06. Data Warehouse & Dimensional Modeling

Transactional databases are built to process one order at a time. A Data Warehouse is built to scan 500 million orders in 2 seconds to tell the CEO which product made the highest profit across 40 countries.

Instructor Insight (© Venkata Bhattaram): "Imagine asking a busy retail cashier who is ringing up items for customers in line: 'Excuse me, could you quickly calculate the total quarterly revenue of organic yogurt across all 500 stores over the last 3 years?' The cashier will look at you like you're crazy, and the line will stall. That is why we never run heavy reporting queries on operational databases (OLTP). We copy data into a dedicated Data Warehouse (OLAP) optimized for aggregations."
The Cash Register vs. Corporate Headquarters Analogy
• The Cash Register (OLTP): Cares about milliseconds, fast writes, and customer checkout. It doesn't care about 5-year trends.
• Corporate Headquarters (OLAP / DWH): Gathers copies of daily receipts from 5,000 stores, consolidates them into unified clean tables, and answers strategic business questions.
The Classic Distinction

OLTP vs. OLAP: The Two Halves of Data Engineering

Every database engine in the world is optimized either for high-speed row-level transactions (OLTP) or high-throughput columnar analytical aggregations (OLAP).

Feature / Characteristic OLTP (Operational Database) OLAP (Analytical Warehouse)
Primary Purpose Run real-time day-to-day business transactions (E-commerce cart, banking transfers). Analyze historical business performance, calculate quarterly trends, executive BI.
Query Nature Simple reads/writes of single rows: SELECT * WHERE user_id = 9201. Massive multi-table joins & aggregations: SUM(revenue), AVG(margin).
Database Engines PostgreSQL, MySQL, Oracle, SQL Server, MongoDB. Snowflake, Google BigQuery, Amazon Redshift, Databricks SQL, ClickHouse.
Storage Layout Row-Oriented (writes fast whole tuples). Column-Oriented (scans millions of values in 1 column).
Ralph Kimball's Blueprint

Dimensional Modeling: Fact Tables & Dimension Tables

In 1996, Ralph Kimball introduced the universal language of Business Intelligence: splitting tables into numerical Facts and descriptive Dimensions.

Numerical Events

Fact Table (What happened?)

Contains numerical measurements of a business event. Usually narrow (mostly Foreign Keys and numbers) but contains billions of rows.

Examples: amount_usd, quantity_sold, discount_pct, duration_seconds.
Contextual Filters

Dimension Table (Who, Where, When?)

Contains rich textual context used to slice, dice, filter, and group the Facts. Usually wide (dozens of columns) but contains fewer rows.

Examples: dim_customer (city, state), dim_product (brand, category), dim_date.
Schema Topology

Star Schema vs. Snowflake Schema

How dimension tables are arranged around the central Fact table.

The Industry Standard

Star Schema (Denormalized)

Dimensions connect directly to the central Fact table with 1 single join. Dimensions are intentionally denormalized (flattened), making SQL queries simple, lightning-fast, and easy for business analysts to understand.

Normalized Dimensions

Snowflake Schema (Normalized)

Dimensions are split into sub-dimensions (e.g. dim_product → dim_brand → dim_category). Reduces data redundancy, but requires complex multi-level SQL joins that can slow down analytical dashboards.

Handling Historical Updates

Slowly Changing Dimensions (SCD Type 1 vs. Type 2)

What happens when customer Alice moves from California to New York? How does your warehouse preserve sales history?

SCD Type 1: Overwrite (No History)

Simply updates Alice's state column to 'NY'.

Problem: Erases past history! Her purchases from 2024 now falsely appear as New York revenue instead of California.
SCD Type 2: Add New Row (Full History)

Closes Alice's California record (end_date = '2026-10-10', is_current = FALSE) and inserts a new row for New York!

Benefit: 100% historical accuracy! 2024 reports stay in California, while new 2026 sales reflect New York.
Interactive Visual Board

Interactive Star Schema Relationship Explorer

Click any Dimension table or the central Fact table to see how Foreign Keys connect the analytical model!