Skip to main content

OLAP vs OLTP; schema, fact, dimension

Short answer

OLTP handles day-to-day transactions; OLAP supports analysis. Warehouse schemas: star (central fact table, denormalised dimensions), snowflake (normalised dimensions), fact constellation (multiple fact tables sharing dimensions). Fact table stores measures and keys, e.g. Sales_Fact(time_key, item_key, branch_key, location_key, units_sold); dimension tables store descriptive attributes, e.g. Time(time_key, day, month, quarter, year).

Differentiate between OLAP & OLTP. Explain the warehouse schema, Fact table and Dimension table with example.

OLAP vs OLTP

PointOLTPOLAP
PurposeDay-to-day transactionsAnalysis, decision support
UsersClerks, clients, DBAsManagers, analysts, executives
DataCurrent, detailed, flat relationalHistorical, summarised, multidimensional
Database designER model, normalised, application-orientedStar/snowflake, subject-oriented
AccessRead/write, short transactionsMostly read, complex queries
Unit of workShort, simple transactionComplex query with aggregates
Records per accessTensMillions
Number of usersThousandsHundreds
DB sizeMB to GBGB to TB
MetricTransaction throughputQuery response time

Warehouse schema

A schema is the logical structure of the warehouse. The dimensional models are:

  • Star schema: central fact table connected to denormalised dimension tables.
  • Snowflake schema: dimensions are normalised into sub-tables.
  • Fact constellation: several fact tables sharing dimensions.
 Time --+          +-- Item
        +-- SALES -+
 Branch-+   FACT   +-- Location

Fact table

Holds the numeric measures and foreign keys. Example: Sales_Fact(time_key, item_key, branch_key, location_key, units_sold, dollars_sold).

Dimension table

Holds descriptive attributes of the dimension. Examples:

  • Time(time_key, day, month, quarter, year)
  • Item(item_key, item_name, brand, type)
  • Branch(branch_key, branch_name, branch_type)
  • Location(location_key, street, city, province, country)

A query "dollars_sold per brand per quarter" joins the fact table with the Item and Time dimensions.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Mining chapter 2 questions →