Skip to main content

OLAP vs OLTP; schema modeling; star DMQL

Short answer

OLTP is for transactions; OLAP for analysis. Warehouse conceptual model is multidimensional with star, snowflake and fact constellation schemas. In DMQL, a star schema is defined by define cube with measures and define dimension for each dimension, e.g. define cube sales_star [time, item, branch, location] with dollars_sold = sum(sales_in_dollars).

Differentiate between OLAP and OLTP. Explain the conceptual modeling of Data Warehouse Schemas. How do you define Star Schema using DMQL?

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

Conceptual modelling of data warehouse schemas

The conceptual model of a warehouse is multidimensional, made of a fact table and dimension tables. There are three common schemas:

  1. Star schema: one central fact table linked to one denormalised table per dimension. Simple and fast.
  2. Snowflake schema: a star whose dimension tables are normalised into more tables to reduce redundancy; more joins.
  3. Fact constellation (galaxy): multiple fact tables share dimension tables; models several related business processes.
 Star:                       Snowflake:
 Time   Item                 Item -> Supplier
   \   /                       \
   SALES -- Branch            SALES -- Location -> City

Defining a star schema in DMQL

DMQL defines a cube and its dimensions. Example (sales):

define cube sales_star [time, item, branch, location]:
    dollars_sold = sum(sales_in_dollars),
    units_sold   = count(*)

define dimension time as
    (time_key, day, day_of_week, month, quarter, year)
define dimension item as
    (item_key, item_name, brand, type, supplier_type)
define dimension branch as
    (branch_key, branch_name, branch_type)
define dimension location as
    (location_key, street, city, province_or_state, country)

The measures become the fact table columns and each dimension a table joined through its key.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Mining chapter 2 questions →