Data Warehouse & OLAP
Inmon's definition, OLTP vs OLAP, data cubes, and star / snowflake / fact constellation schemas.
Contents
- Explain data warehouse and OLAP concepts
- Explain data warehouse architecture and schemas
- Introduce the concept of OLAP
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:
- A decision support database that is maintained separately from the organization’s operational database.
- Supports information processing by providing a solid platform of consolidated, historical data for analysis.
“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.
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.
Subject-oriented · Integrated · Time-variant · Nonvolatile. Expect to explain all four in an exam.
Subject-oriented
- Organized around major subjects, such as customer, product, sales.
- Focuses on modelling and analysis of data for decision makers, not on daily operations or transaction processing.
- Provides a simple and concise view around particular subject issues by excluding data not useful in the decision support process.
Integrated
- Constructed by integrating multiple, heterogeneous data sources — relational databases, flat files, on-line transaction records.
- Data cleaning and data integration techniques are applied to ensure consistency in naming conventions, encoding structures, attribute measures, etc. among sources.
- e.g. hotel price: different sources may differ in currency, whether tax is included, whether breakfast is covered…
- When data is moved into the warehouse, it is converted.
Time-variant
- The time horizon is significantly longer than that of operational systems.
- Operational database: current value data.
- Data warehouse: information from a historical perspective (e.g. past 5–10 years).
- Every key structure in the warehouse contains an element of time, explicitly or implicitly — whereas the key of operational data may or may not contain a time element.
Nonvolatile
- A physically separate store of data transformed from the operational environment.
- Operational updates do not occur in the warehouse environment.
- Does not require transaction processing, recovery and concurrency control mechanisms.
- Requires only two operations in data accessing: initial loading of data and access of data.
How organizations use data warehouses
Many organizations use warehouse information to support business decision making, e.g.:
- Increasing customer focus — analysing customer buying patterns (buying preference, buying time, budget cycles, appetite for spending).
- Repositioning products and managing product portfolios — comparing sales performance by quarter, by year and by geographic region to fine-tune production strategies.
OLTP vs OLAP
| OLTP Online Transaction Processing | OLAP Online Analytical Processing | |
|---|---|---|
| Users | Clerk, IT professional | Knowledge worker |
| Function | Day-to-day operations | Decision support |
| DB design | ER diagram, application-oriented | Star/snowflake, subject-oriented |
| Data | Current, up-to-date, detailed, flat relational, isolated | Historical, summarized, multidimensional, integrated, consolidated |
| Usage | Repetitive | Ad hoc |
| Unit of work | Short, simple transaction | Complex query |
| # records accessed | Tens | Millions |
| # users | Thousands | Hundreds |
| DB size | 100 MB – GB | 100 GB – TB |
Why a separate data warehouse?
High performance for both systems:
- The operational DBMS is tuned for OLTP: access methods, indexing, concurrency control, recovery.
- The warehouse is tuned for OLAP: complex OLAP queries, multidimensional view, consolidation.
Different functions and different data:
- Missing data — decision support needs historical data that operational DBs typically don’t keep.
- Data consolidation — decision support needs aggregation/summarization of data from heterogeneous sources.
- Data quality — different sources use inconsistent representations, codes and formats that must be reconciled.
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 entertainment | computer | phone | security |
|---|---|---|---|---|
| Q1 | 605 | 825 | 14 | 400 |
| Q2 | 680 | 952 | 31 | 512 |
| Q3 | 812 | 1023 | 30 | 501 |
| Q4 | 927 | 1038 | 38 | 580 |
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.
| time | Chicago | New York | ||||||
|---|---|---|---|---|---|---|---|---|
| home | comp. | phone | sec. | home | comp. | phone | sec. | |
| Q1 | 854 | 882 | 89 | 623 | 1087 | 968 | 38 | 872 |
| Q2 | 943 | 890 | 64 | 698 | 1130 | 1024 | 41 | 925 |
| Q3 | 1032 | 924 | 59 | 789 | 1034 | 1048 | 45 | 1002 |
| Q4 | 1129 | 992 | 63 | 870 | 1142 | 1091 | 54 | 984 |
| time | Toronto | Vancouver | ||||||
|---|---|---|---|---|---|---|---|---|
| home | comp. | phone | sec. | home | comp. | phone | sec. | |
| Q1 | 818 | 746 | 43 | 591 | 605 | 825 | 14 | 400 |
| Q2 | 894 | 769 | 52 | 682 | 680 | 952 | 31 | 512 |
| Q3 | 940 | 795 | 58 | 728 | 812 | 1023 | 30 | 501 |
| Q4 | 978 | 864 | 59 | 784 | 927 | 1038 | 38 | 580 |
Each cell holds a measure (dollars_sold) for one (time, item, location) combination. Front face = Vancouver.
From tables and spreadsheets to data cubes
- A data warehouse is based on a multidimensional data model, which views data as a data cube.
- A data cube (e.g. sales) lets data be modelled and viewed in multiple dimensions:
- Dimension tables — e.g. item(item_name, brand, type) or time(day, week, month, quarter, year).
- Fact table — contains measures (e.g. dollars_sold) and keys to each related dimension table.
- An n-D base cube is called a base cuboid. The top-most 0-D cuboid, holding the highest level of summarization, is the apex cuboid. The lattice of cuboids forms a data cube.
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:
| Schema | Description |
|---|---|
| Star schema | A fact table in the middle connected to a set of dimension tables. |
| Snowflake schema | A refinement of the star schema where some dimensional hierarchy is normalized into a set of smaller dimension tables, forming a snowflake-like shape. |
| Fact constellation | Multiple fact tables share dimension tables — a collection of stars, also called a galaxy schema. |
Star schema
The most common modelling paradigm. The warehouse contains:
- a large central table (fact table) containing the bulk of the data, with no redundancy; and
- 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.
The fact table holds the four foreign keys plus the measures (units_sold, dollars_sold, avg_sales). Each dimension table describes one dimension.
The slide shows province_or_street in the location dimension; the textbook attribute is province_or_state.
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
| Operation | What it does | Example |
|---|---|---|
| Roll-up (drill-up) | Summarize by climbing a hierarchy or removing a dimension | city → country; quarter → year |
| Drill-down | Reverse of roll-up: go to more detail | quarter → month |
| Slice | Select on one dimension → a sub-cube | time = Q1 |
| Dice | Select on two or more dimensions | location ∈ {Toronto, Vancouver} and item ∈ {home, computer} |
| Pivot (rotate) | Rotate the axes for a different view | swap item and location axes |