Professional Documents
Culture Documents
DWI - Lecture - 7 - Dimensional
DWI - Lecture - 7 - Dimensional
DWI - Lecture - 7 - Dimensional
Data Warehouses
• Goal:
Notes on Fact tables
Notes on Dimension tables
OLT
event DW
tran1 P event
event
tran2
tran3
OLT
status DW
OLT
event DW
tran1 P
atran1 event
tran2
tran3
atran2
Fact Tables
OLT
status DW
tran1 P
tran2
tran3
Fact Tables
OLT
status DW
tran1 P
tran2
tran3
Fact Tables
event
OLT
s1 DW
tran1 P s2
tran2 s3
tran3
Fact Tables
• Types of facts:
accumulating snapshots in
transactional fact table
fact table records one row for each
status change or milestone achieved
contents of the status dimension reveals
the major processing steps
event
OLT
s1 DW
tran1 P s2
tran2 s3
tran3
Fact Tables
• Types of facts:
accumulating snapshot fact
summarizes the measurement events occurring at predictable
steps between the beginning and the end of a process
contains multiple references to the date dimension
date foreign key in the fact table for each critical milestone in
the process
event
OLT
s1 DW
tran1 P s2
tran2 s3
tran3
Fact Tables
• Types of Facts
”Fact-less” facts
A fact per event (customer contact)
so-called event fact
No numerical measures
An event has happened for a given dimension value combination
For example, an event of a student attending a class on a given day
may not have a recorded numeric fact,
but a fact row with foreign keys for day, student, teacher,
• Conformed Facts
The same measurement might appear in separate fact tables
care must be taken to make sure the technical definitions of the
facts are identical if they are to be compared or computed together
If the separate fact definitions are consistent, the conformed
• Drilling Down
the most fundamental way data is analyzed by business
users
simply means adding a row header to an existing query
the new row header is a dimension attribute appended to the
GROUP BY expression in an SQL query
The attribute can come from any dimension attached to the fact
• Hierarchies
E.g. time:
month -> quarter -> year
January ?
Q1 ?
• Instance hierarchies
are defined as relationships between rows
of the dimension.
hierarchy exists among instances of
dimensions
are recursive
Drilling process does not involve adding or
Traps:
Treating abstract attributes as a part of a larger dimension
Order
Date
Due Ship
Date Fact Date
Dimension Table
• Identify dimensions
Abstract
Degenerate
Role-playing
Conformed
Hint:
redundancy may be ok (in well-chosen places)
But you should not try to model all relationships in the data
(unlike E/R and OO modeling!)
ID Name City
ID Name City
1 Nowak Warsaw
Data Warehouses - 2021/22
• Slowly changing dimensions
Type 2
Tracks historical data by creating multiple records
changes add a new row in the dimension with the updated
attribute values
This requires generalizing the primary key of the dimension
beyond the natural key because there will potentially be multiple
rows describing each member.
for a given natural key in the dimensional tables with separate
surrogate keys and/or different version numbers.
ID Name City
1 Nowak Wroclaw 0
2 Nowak Warsaw 1
• Slowly Changing Dimensions
The Type 2 SCD perfectly partitions history
each detailed version of a dimensional entity is correctly connected
to the span of fact table records for which that version is
exactly correct
1 1 Nowak Wroclaw 0
2 1 Nowak Warsaw 1
• Although the type 2 change preserves the historic
context of facts, it does not preserve history in the
dimension.
given natural key has taken on multiple representations in
the dimension
we do not know when each of these representations was
correct
this information is only provided by way of a fact
ID Name City
1 Nowak Wroclaw
• Type 3
when there is a need to analyse all facts, those recorded
before and after the change, with either the old value or the
new value
neither type 1 nor type 2 does the job here
ID Name City
ID Name City
ID Name City
1 Nowak Warsaw
Question
Can we analyse how the color changes in a room over time?
ID Name City
ID Name City
1 Nowak Wroclaw
DIMI DIMN …
D ID
101 10
DIMN …
… DIMI DIMN …
ID
D ID
10
101 10
…
101 10
• Adamson C.
Star Schema The Complete Reference
McGraw-Hill, 2010
• Inmon W.,