☰ Chapters
Week 11 · Data Warehouse & OLAP
CT004-3.5-3 Advanced Database Systems · Week 11

Data Warehouse & OLAP

Inmon's definition, OLTP vs OLAP, data cubes, and star / snowflake / fact constellation schemas.

Contents
    Learning outcomes

    Key terms: OLTP · OLAP · Data Cube · Star Schema. Source: Han & Kamber, Data Mining: Concepts and Techniques.

    What is a data warehouse?

    Defined in many ways, but not strictly. Loosely:

    W. H. Inmon’s definition

    “A data warehouse is a subject-oriented, integrated, time-variant, and nonvolatile collection of data in support of management’s decision-making process.”

    Data warehousing = the process of constructing and using data warehouses.

    From the lecture notes

    A data warehouse is a semantically consistent data store that physically implements a decision-support data model and stores the information an enterprise needs to make strategic decisions. It is also viewed as an architecture, built by integrating data from multiple heterogeneous sources to support structured and ad-hoc queries, analytical reporting and decision making.

    Memory aid — “SITN”

    Subject-oriented · Integrated · Time-variant · Nonvolatile. Expect to explain all four in an exam.

    Subject-oriented

    Integrated

    Time-variant

    Nonvolatile

    How organizations use data warehouses

    Many organizations use warehouse information to support business decision making, e.g.:

    OLTP vs OLAP

    OLTP
    Online Transaction Processing
    OLAP
    Online Analytical Processing
    UsersClerk, IT professionalKnowledge worker
    FunctionDay-to-day operationsDecision support
    DB designER diagram, application-orientedStar/snowflake, subject-oriented
    DataCurrent, up-to-date, detailed, flat relational, isolatedHistorical, summarized, multidimensional, integrated, consolidated
    UsageRepetitiveAd hoc
    Unit of workShort, simple transactionComplex query
    # records accessedTensMillions
    # usersThousandsHundreds
    DB size100 MB – GB100 GB – TB

    Why a separate data warehouse?

    High performance for both systems:

    Different functions and different data:

    Extra

    Running heavy analytical queries directly on the OLTP system would lock and slow down the tables that day-to-day transactions depend on — another practical reason to separate them.

    The multidimensional data model

    2-D view — AllElectronics sales (Vancouver)

    Dimensions time (quarter) and item (type); measure = dollars sold (in thousands).

    time (quarter)home entertainmentcomputerphonesecurity
    Q160582514400
    Q268095231512
    Q3812102330501
    Q4927103838580

    3-D view — adding location

    Now view by time, item and location (Chicago, New York, Toronto, Vancouver). Conceptually this is a cube; as tables it is a series of 2-D tables, one per city.

    timeChicagoNew York
    homecomp.phonesec.homecomp.phonesec.
    Q185488289623108796838872
    Q2943890646981130102441925
    Q310329245978910341048451002
    Q41129992638701142109154984
    timeTorontoVancouver
    homecomp.phonesec.homecomp.phonesec.
    Q18187464359160582514400
    Q28947695268268095231512
    Q394079558728812102330501
    Q497886459784927103838580
    item (types) time (quarters) location (cities) 60582514400

    Each cell holds a measure (dollars_sold) for one (time, item, location) combination. Front face = Vancouver.

    From tables and spreadsheets to data cubes

    all (apex, 0-D) time item location time, item time, location item, location time, item, location (base)

    With 3 dimensions there are 2³ = 8 cuboids: 1 apex (0-D), 3 one-D, 3 two-D, and 1 base (3-D).

    Conceptual modelling: star, snowflake, fact constellation

    Data warehouses are modelled with dimensions and measures:

    SchemaDescription
    Star schemaA fact table in the middle connected to a set of dimension tables.
    Snowflake schemaA refinement of the star schema where some dimensional hierarchy is normalized into a set of smaller dimension tables, forming a snowflake-like shape.
    Fact constellationMultiple fact tables share dimension tables — a collection of stars, also called a galaxy schema.

    Star schema

    The most common modelling paradigm. The warehouse contains:

    1. a large central table (fact table) containing the bulk of the data, with no redundancy; and
    2. a set of smaller attendant tables (dimension tables), one per dimension.

    The schema graph resembles a starburst, with dimension tables displayed radially around the central fact table.

    Sales Fact Table time_keyitem_keybranch_keylocation_key units_solddollars_soldavg_sales time time_keydayday_of_the_weekmonthquarteryear item item_keyitem_namebrandtypesupplier_type branch branch_keybranch_namebranch_type location location_keystreetcityprovince_or_statecountry measures

    The fact table holds the four foreign keys plus the measures (units_sold, dollars_sold, avg_sales). Each dimension table describes one dimension.

    Slide note

    The slide shows province_or_street in the location dimension; the textbook attribute is province_or_state.

    Extra · star vs snowflake example

    In a snowflake version, the item dimension’s supplier information would be moved into its own supplier(supplier_key, supplier_type) table, and location’s city into city(city_key, city, province_or_state, country). This saves space (less redundancy) but needs more joins, so star schemas are more popular for query speed.

    A fact constellation would add, say, a shipping fact table sharing the time, item and location dimensions with sales.

    -- Typical star-schema query: total dollars sold per city per quarter in 2026
    SELECT   l.city, t.quarter, SUM(f.dollars_sold) AS total_sales
    FROM     sales f
    JOIN     time t     ON f.time_key = t.time_key
    JOIN     location l ON f.location_key = l.location_key
    WHERE    t.year = 2026
    GROUP BY l.city, t.quarter
    ORDER BY l.city, t.quarter;

    OLAP operations

    Extra · common OLAP operations on a cube
    OperationWhat it doesExample
    Roll-up (drill-up)Summarize by climbing a hierarchy or removing a dimensioncity → country; quarter → year
    Drill-downReverse of roll-up: go to more detailquarter → month
    SliceSelect on one dimension → a sub-cubetime = Q1
    DiceSelect on two or more dimensionslocation ∈ {Toronto, Vancouver} and item ∈ {home, computer}
    Pivot (rotate)Rotate the axes for a different viewswap item and location axes

    Quick review

    Give Inmon’s definition of a data warehouse and explain each property.
    Subject-oriented (organized around subjects like customer/product), integrated (heterogeneous sources cleaned and made consistent), time-variant (historical, keys include time), nonvolatile (separate store; only initial load and read access).
    Give four differences between OLTP and OLAP.
    Users (clerks vs knowledge workers); function (daily operations vs decision support); data (current, detailed vs historical, summarized); unit of work (short transactions vs complex queries); records accessed (tens vs millions); DB size (MB–GB vs GB–TB).
    What’s in a fact table vs a dimension table?
    Fact table: measures (numeric facts) + foreign keys to each dimension. Dimension table: descriptive attributes of one dimension (e.g. item_name, brand, type).
    What are the base cuboid and apex cuboid?
    Base cuboid: the n-D cube at the lowest level of detail. Apex cuboid: the 0-D cuboid with the highest level of summarization (grand total).
    Star vs snowflake vs fact constellation?
    Star: one fact table + denormalized dimension tables. Snowflake: dimension hierarchies normalized into smaller tables. Fact constellation (galaxy): multiple fact tables sharing dimensions.