CS24303 • Module 3

Module 3: Data Warehousing & OLAP Technology

Topics 21 to 29 • Star/Snowflake Schemas, Measures, OLAP Operations, Cuboid Lattices & BUC
Module 3 Table of Contents (Topics 21 to 29)
• Topic 21: Data Warehouse Foundations & Architecture
• Topic 22: OLTP vs. OLAP Multidimensional Paradigms
• Topic 23: Schemas (Star, Snowflake, Fact Constellation)
• Topic 24: Measures (Additive, Semi-additive, Non-additive)
• Topic 25: OLAP Operations (Roll-up, Drill-down, Slice, Dice, Pivot)
• Topic 26: Data Cube Computation (MOLAP, ROLAP, HOLAP)
• Topic 27: Star-Cubing & BUC Algorithms
• Topic 28: Concept Hierarchies & Attribute-Oriented Induction
• Topic 29: 15 Solved University Examination Bank

Topic 21 & 22: Data Warehouse Architecture & OLTP vs. OLAP

According to William H. Inmon (the father of data warehousing), a Data Warehouse is defined as: "A subject-oriented, integrated, time-variant, and non-volatile collection of data in support of management's decision-making process."

Characteristic Inmon's Definition Technical Implementation
Subject-Oriented Organized around major business subjects (Customer, Product, Sales, Supplier) rather than operational transactional processes (order entry, invoicing). De-normalized multi-dimensional schema tables optimizing cross-departmental queries.
Integrated Constructed by integrating heterogeneous sources (relational DBs, flat files, legacy systems). Naming inconsistencies, encoding formats, and conflicting measurement units are unified. ETL (Extract, Transform, Load) staging pipelines enforcing global enterprise metadata standards.
Time-Variant Every key record in the data warehouse explicitly contains a time dimension key (Day, Month, Quarter, Year), capturing historical snapshots across a 5–10 year horizon. Slowly Changing Dimensions (SCD Type 1, 2, 3), append-only historical fact tables.
Non-Volatile Data is never updated or deleted in place by end-users. Once loaded into the warehouse, records remain static and read-only. Periodic batch loads; high-speed read-optimized indexing (Bitmap, B-tree indexes).

Topic 23 & 24: Multidimensional Schemas & Categorization of Measures

FACT_SALES time_key (FK), item_key (FK) branch_key (FK), dollars_sold units_sold (Additive) DIM_TIME time_key, day, month, year DIM_ITEM item_key, item_name, brand
Figure 3.1: The Star Schema Architecture (Central Fact Table radiating to Dimension Tables)
Schema Architecture Structural Design Key Advantages & Trade-offs
Star Schema A single central fact table referencing multiple completely de-normalized dimension tables via foreign keys. Extremely simple queries; minimal SQL joins; redundant storage in dimension tables.
Snowflake Schema A refinement of the star schema where dimension tables are normalized into hierarchies (splitting `DIM_ITEM` into `ITEM`, `CATEGORY`, `SUPPLIER`). Zero data redundancy; saves disk storage; complex multi-table SQL joins reduce OLAP query performance!
Fact Constellation (Galaxy) Multiple distinct fact tables (e.g. `FACT_SALES` and `FACT_SHIPPING`) sharing common dimension tables (Conformed Dimensions). Enterprise-wide standard supporting complex business intelligence workflows across multiple functional divisions.
Categorization of Multidimensional Measures: - Additive Measures: Can be meaningfully aggregated across ALL dimensions (e.g., `units_sold`, `dollars_revenue`, `cost_amount`). - Semi-Additive Measures: Can be aggregated across some dimensions, but NOT across the Time dimension (e.g., `bank_account_balance`, `warehouse_inventory_count` — summing balances across 365 days gives a meaningless number!). - Non-Additive Measures: Cannot be aggregated across any dimension by simple addition (e.g., `unit_price`, `profit_margin_%`, `temperature_celsius`). Must compute aggregate numerator and aggregate denominator separately ($\text{AvgMargin} = \frac{\sum \text{Profit}}{\sum \text{Revenue}}$).

Topic 25 to 27: OLAP Operations & Data Cube Computation

OLAP Operation Algorithmic Transformation Business Analytics Example
Roll-Up (Drill-Up) Performs aggregation on a data cube by climbing up a concept hierarchy or by dimension reduction (dropping a dimension). Aggregating daily sales records into quarterly totals: `Day` $\rightarrow$ `Month` $\rightarrow$ `Quarter` $\rightarrow$ `Year`.
Drill-Down (Roll-Down) Navigates from less detailed (high-level summary) data to highly detailed granular data by descending a concept hierarchy or introducing an additional dimension. De-aggregating national quarterly revenue down to city-level store performance: `Country` $\rightarrow$ `State` $\rightarrow$ `City` $\rightarrow$ `Store`.
Slice Performs a selection on one dimension of the given cube, resulting in a sub-cube of lower dimensionality (cutting a 2D slice from a 3D cube). Filtering the sales cube strictly for `Time = "Q1_2024"`.
Dice Defines a sub-cube by performing a selection on two or more dimensions simultaneously. Filtering for `(Location = "Toronto" OR "Vancouver") AND (Time = "Q1" OR "Q2") AND (Item = "Electronics")`.
Pivot (Rotate) Rotates the data axes in space to provide an alternative visual presentation of the multidimensional matrix. Swapping row axis (`Product`) with column axis (`Quarter`) in a spreadsheet pivot table.
🏛️ Step-by-Step Solved Problem: Cuboid Lattice Combinatorics

An enterprise data warehouse has 4 dimensions: $\text{Time } (D_1), \text{Item } (D_2), \text{Location } (D_3), \text{Supplier } (D_4)$.

  1. Calculate the total number of cuboids in the full data cube lattice.
  2. If dimension $\text{Time}$ has hierarchy `Day` $\rightarrow$ `Month` $\rightarrow$ `Quarter` $\rightarrow$ `Year` ($L_1 = 4$ levels + `all`), $\text{Item}$ has 3 levels ($L_2 = 3$), $\text{Location}$ has 3 levels ($L_3 = 3$), and $\text{Supplier}$ has 2 levels ($L_4 = 2$), calculate the total number of cuboids with hierarchies.

Mathematical Solution:

Topic 29: Master University Examination Solved Question Bank

Q1. Compare ROLAP, MOLAP, and HOLAP Architectures. (10 Marks)
DimensionROLAP (Relational OLAP)MOLAP (Multidimensional OLAP)HOLAP (Hybrid OLAP)
Underlying StorageRelational DBMS (Star/Snowflake tables).Proprietary multidimensional arrays (dense matrices).Relational DB for detailed base data; MOLAP arrays for aggregated summaries.
ScalabilityExtremely high (handles petabytes).Moderate (limited by disk RAM array expansion).High scalability with optimized query speed.
Query SpeedSlower (requires complex SQL multi-joins).Lightning fast ($O(1)$ array offset indexing).Fast for high-level summaries.
Storage OverheadLow (only stores populated records).High (sparse matrix indexing required).Balanced.
Q2. Explain the Bottom-Up Computation (BUC) Algorithm for Iceberg Cubes. (8 Marks)
An Iceberg Cube computes only those cuboid cells whose aggregate measure satisfies an iceberg condition (e.g. `HAVING COUNT(*) >= min_support`).
BUC Algorithm: Computes data cubes from bottom to top (from 1-D apex children down to base cuboids). It exploits the Apriori anti-monotonicity property: If an aggregate count of a cell in a parent cuboid fails `min_support`, none of its descendant child cells can satisfy the condition! BUC immediately prunes the entire subtree beneath that cell, eliminating massive wasteful computations!

Topic 29.1: Advanced Dimensional Modeling & Indexing Strategies

Indexing Architecture Internal Bitwise Mechanism Best OLAP Query Type
Bitmap Indexing Creates a bit vector for each distinct value of a low-cardinality attribute (e.g. `Gender: {M: 1010, F: 0101}`). Queries execute via hardware-accelerated bitwise AND/OR/NOT operations. Low-cardinality categorical filters (`WHERE Region = 'East' AND Status = 'Active'`).
Join Indexing Maintains index relationships between foreign keys of fact tables and primary keys of dimension tables across multi-table joins without physical table joining. Star schema star-join query acceleration.
Bitmapped Join Index Stores bitmap representations of dimension attributes directly inside the fact table index. Complex multi-attribute enterprise OLAP reporting.
🏛️ Step-by-Step Solved Problem: Bitmap Index Bitwise Query Processing

A customer table has 6 records. Attribute Gender has distinct values $\{M, F\}$; Attribute CustType has distinct values $\{VIP, Regular\}$:

Query: Find all Female customers who are VIP (`Gender = 'F' AND CustType = 'VIP'`):

$$\mathbf{\text{Result} = \text{Bit}_F \land \text{Bit}_{VIP} = [0, 1, 0, 0, 1, 1] \text{ AND } [1, 1, 0, 1, 0, 0] = \mathbf{[0, 1, 0, 0, 0, 0]}}$$ $$\mathbf{\text{Interpretation: Record index 2 (Customer 2) is the exact matching tuple! (Computed in 1 CPU cycle!)}}}$$
Q3. Explain Slowly Changing Dimensions (SCD Type 1, Type 2, and Type 3). (8 Marks)
In a data warehouse, dimension attribute values change over time (e.g. customer relocates from Chicago to Dallas):
• SCD Type 1 (Overwrite): Overwrites the old value with the new value. Fast, but destroys historical context (past sales in Chicago are falsely credited to Dallas).
• SCD Type 2 (Add New Row): Creates a new row with a new surrogate key, marking the old row with `end_date` and `is_current = FALSE`. Preserves complete historical audit trail (industry gold standard).
• SCD Type 3 (Add New Column): Adds a `current_city` and `previous_city` column to the existing row. Tracks only the immediate prior state.

Topic 29.2: Advanced Star-Cubing & Materialized View Optimization

🏛️ Step-by-Step Solved Problem: Materialized View Selection using the Greedy (HRU) Algorithm

A data cube lattice has base cuboid $V_0$ (cost = 100). The costs of computing each dependent cuboid view and their lattice ancestor dependencies are given below. Select top $k = 2$ views to materialize to maximize total query evaluation benefit:

Step 1: Calculate Benefit of materializing first view:

$$\mathbf{\text{Choice 1: Select } V_2 \text{ with Maximum Benefit } = \mathbf{210}!}$$

Step 2: Calculate Marginal Benefit given $V_2$ is already materialized (cost of $V_3, V_4$ now reduced to 30):

$$\mathbf{\text{Choice 2: Select } V_1 \text{ with Marginal Benefit } = \mathbf{50}!}$$ $$\mathbf{\text{Final Optimal Views to Materialize: } \{V_2, V_1\} \quad (\text{Total Benefit } = 210 + 50 = \mathbf{260})}$$

Topic 29.3: Master University Exam Problem Bank (Part II)

🏛️ Solved Problem 3: Data Cube Aggregation with the Multi-Way Array Aggregation Algorithm

The Multi-Way Array Aggregation (Zhao et al. 1997) algorithm computes a full multidimensional MOLAP data cube in a single pass over memory arrays:

  1. Partition the multidimensional array into chunks that fit in RAM cache.
  2. Order dimensions such that the dimension with the largest size/cardinality is placed first ($D_1 \times D_2 \times D_3$).
  3. Scan chunk by chunk, aggregating along 2D planes and 1D lines simultaneously without re-reading chunks from disk!
  4. Minimizes total memory requirement to $O(|D_2 \times D_3| + |D_3|)$ rather than the full $O(|D_1 \times D_2 \times D_3|)$!
Q4. Compare Enterprise Data Warehouse, Data Mart, and Virtual Warehouse. (8 Marks)
• Enterprise Data Warehouse (EDW): An enterprise-wide, unified repository collecting data across all functional business departments (Finance, Marketing, HR, Operations). Requires extensive corporate schema design.
• Data Mart: A subset of enterprise data focused on a single department or specific business line (e.g., Marketing Data Mart). Can be dependent (sourced directly from EDW) or independent (sourced directly from operational DBs).
• Virtual Warehouse: A set of relational views over operational transactional databases. Zero physical storage required, but severely degrades operational OLTP performance when complex queries execute!
Q5. Explain Surrogate Keys in Data Warehousing and why operational primary keys should NEVER be used. (6 Marks)
A Surrogate Key is an artificial, system-generated integer primary key (e.g., `1001, 1002`) used in dimension tables.
• Why Not Operational PKs? (1) Natural operational keys change over time (e.g. employee SSN re-issued), (2) Heterogeneous source systems use conflicting PK formats, and (3) Tracking Slowly Changing Dimensions (SCD Type 2) requires multiple historical rows for the same operational entity (which violates operational PK uniqueness!).

Topic 29.4: Master University Exam Problem Bank (Part III)

🏛️ Solved Problem 4: Star-Cubing Shared-Prefix Tree Construction

Star-Cubing (Xu et al. 2001) integrates top-down and bottom-up data cube computation with star-tree structures:

Q6. Compare Fact Tables vs Dimension Tables in Data Warehouse Design. (8 Marks)
DimensionFact TableDimension Table
ContentsNumeric additive business measurements (revenue, quantities) and composite FKs.Descriptive qualitative textual context (names, categories, addresses).
Growth & SizeMassive (millions to billions of rows; grows continuously).Small to moderate (hundreds to thousands of rows).
GranularityDefined at atomic leaf transaction level.Hierarchical roll-up levels (Store $\rightarrow$ City $\rightarrow$ State $\rightarrow$ Country).
StructureTall, narrow (few columns, massive rows).Short, wide (many descriptive textual columns).

Topic 29.5: Master University Exam Problem Bank (Part IV)

🏛️ Solved Problem 5: Fact Table Sizing & Storage Capacity Estimation

A national retail chain with 500 physical stores sells 10,000 distinct products. On average, each store processes 2,000 sales transactions per day with an average of 4 items per transaction:

Q7. Compare Kimball's Dimensional Bus Architecture with Inmon's Corporate Information Factory (CIF). (10 Marks)
DimensionBill Inmon (Top-Down CIF)Ralph Kimball (Bottom-Up Bus)
Central ArchitectureSingle enterprise normalized relational DW (3NF). Data marts are departmental downstream extracts.No centralized 3NF EDW. The warehouse is the union of all dimensional star-schema data marts.
Integration MechanismEnterprise Data Model (EDM).Conformed Dimensions and Conformed Facts.
Implementation SpeedSlow initial ramp-up (high upfront engineering cost).Fast iterative delivery; agile business value per mart.
End-User AccessUsers query data marts, not the core 3NF EDW.Users query dimensional star schemas directly.
Q8. Detail the Mechanics of Materialized Query Tables (MQT) and Automatic Query Rewrite. (8 Marks)
A Materialized Query Table (MQT / Indexed View) physically stores pre-aggregated query results on disk. When an end-user submits a complex SQL aggregation query (e.g. `SELECT Year, Region, SUM(Sales)...`), the RDBMS Cost-Based Query Optimizer automatically rewrites the execution plan to read directly from the compact MQT rather than scanning the massive 1.5-billion-row base fact table, reducing query execution latency from minutes to milliseconds!

Topic 29.6: Complete Solved Laboratory Problem Bank on OLAP Aggregations

🏛️ Solved Numerical 6: Bitmap Index Vector Compression via Run-Length Encoding (WAH)

A high-cardinality bitmap index bit vector has 128 bits containing sparse ones: `00000000 00000000 ... 00000001`:

🏛️ Solved Problem 9: Incremental View Maintenance in Real-Time Data Warehouses

When operational databases insert new delta records $\Delta R$:

🏛️ Solved Problem 10: Star-Cubing Shared-Prefix Path Algorithm

Constructs a tree where nodes represent attribute-value pairs and links represent prefix sharing. Performs recursive top-down cuboid lattice traversal with bottom-up aggregation!

🏛️ Solved Numerical 10: Multi-Tiered Data Warehouse Physical Storage Layouts

In columnar analytical data warehouses (Snowflake, BigQuery, ClickHouse), data is stored column-by-column rather than row-by-row:

Q9. Compare Star Schema with Constellation Schema for Multi-Departmental Enterprises. (8 Marks)
A single Star Schema contains only one central fact table, suitable for isolated departmental data marts (e.g. Sales). An enterprise-wide system requires a Fact Constellation (Galaxy) Schema with multiple fact tables (e.g., `Sales_Fact`, `Inventory_Fact`, `Shipping_Fact`) interconnected via shared Conformed Dimensions (`Dim_Date`, `Dim_Product`, `Dim_Store`), preventing fragmented analytical silos and enabling cross-functional enterprise intelligence!
🏛️ Solved Problem 12: Factless Fact Table Applications in Business Intelligence

A Factless Fact Table contains NO numeric measurement facts (no dollars or quantities); it contains ONLY foreign keys pointing to dimension tables:

🏛️ Solved Problem 14: Semi-Additive vs Additive vs Non-Additive Measure Design

In a financial banking data warehouse:

🏛️ Solved Problem 15: Slowly Changing Dimensions Type 4 (History Table) vs Type 6 (Hybrid)

• SCD Type 4: Maintains a primary dimension table with current attributes, and writes historical changes to a separate history fact table.
• SCD Type 6 (1 + 2 + 3): Hybrid schema containing both historical rows (Type 2) and current overwrite columns (Type 3) alongside surrogate keys!

🏛️ Solved Problem 16: Star-Tree Construction Algorithm & Iceberg Condition Pruning

In Star-Cubing, each node $N$ stores a star-table and aggregate counts. If $\text{count}(N) < \text{min\_support}$, the star-tree node is dropped and all child cuboid branches are pruned in a single operation!