Escolar Documentos
Profissional Documentos
Cultura Documentos
Dimensional Modeling
Prof.dr.ing. Florin Radulescu
Universitatea Politehnica din Bucureti
DMDW-12
Facts
DMDW-12
Additive measures
Semi-Additive
DMDW-12
DMDW-12
DMDW-12
Non-additive measures
Non-additive measures cannot be aggregated
across all/any dimension.
A classical example is the unit price.
Considering a retail company, the sum of unit
prices along any dimension (product, customer,
location, etc.) is not meaningful.
For that reason, if these values can be computed
based on additive measures, the non-additive
measures are not stored in the fact tables.
For our example, the unit price can always be
computed dividing total cost by the quantity sold.
Grain
The level of detail of o record in a fact
table is called the grain of the table.
Besides business process measurements,
the fact table contains also foreign keys for
all the dimension tables and possibly
some pseudo-foreign keys for some
degenerate dimensions.
More details on this topic in the next
paragraphs of this lesson.
DMDW-12
DMDW-12
Dimensions
Dimensions
DMDW-12
DMDW-12
10
Star scheme
Advantages
Each fact table is surrounded by several linked
dimension tables, as in Figure 1.
Because of its appearance, such a construction is
called a star scheme.
A star scheme has several advantages:
Is easy to understand. Graphic representations have
almost always this advantage
Provide better performance: data is de-normalized in
fact and dimension tables, so for obtaining a query
result needs only the joins between the fact table and
the implied dimensions
Is extensible. Attributes and dimensions may be
added easily
Florin Radulescu, Note de curs
11
DMDW-12
12
DMDW-12
SQL Query
Snow-flake schemes
// join condition
DMDW-12
13
DMDW-12
14
Example
Road Map
Facts and dimensions
Steps in dimensional modeling
Modeling example
Summary
15
DMDW-12
17
DMDW-12
DMDW-12
16
18
DMDW-12
DMDW-12
19
No duplicate data
No duplicate data
21
DMDW-12
22
DMDW-12
23
DMDW-12
20
24
DMDW-12
Discussion
Discussion
DMDW-12
25
Features cont.:
Provides maximum analytic flexibility,
Detailed data allow more ad hoc queries,
Low level grain does not prohibit adding also
summary high level grain in the DW for speeding
up frequent queries and reports.
DMDW-12
27
28
DMDW-12
DMDW-12
29
DMDW-12
26
30
DMDW-12
DMDW-12
31
DMDW-12
32
Discussion
Discussion
DMDW-12
33
Road Map
Modeling example
A retail sales modeling example is presented in
[Kimball, Ross, 2002] for a store chain.
Each store has several departments and sales
several tens of thousands items (called stock
keeping units SKU).
Each SKU has either a universal product code
imprinted by the manufacturers or a local code for
bulk goods (for example agricultural products vegetables and fruits, meat, bakery, etc.).
Package variation of a product is another SKU and
by consequence has a different code.
35
DMDW-12
34
DMDW-12
36
DMDW-12
Modeling example
Step 1
DMDW-12
37
DMDW-12
38
Step 2
Step 3
DMDW-12
39
Date
Date_Key (PK)
Date attributes
Step 3 - details
Store
Store_Key (PK)
Store attributes
POS_Sales
Product_Key (FK)
Date_Key (FK)
Store_Key (FK)
SP_Key (FK)
Promotion_Key (FK)
Ticket_number (FK)
Fact table attributes
Salesperson
SP_Key (PK)
SP attributes
Promotion
Promotion_Key (PK)
Promotion attributes
41
DMDW-12
40
DMDW-12
42
DMDW-12
Degenerate dimensions
Degenerate dimensions
DMDW-12
43
DMDW-12
44
Product
Product_Key (PK)
Product attributes
Date
Date_Key (PK)
Date attributes
POS_Sales
Product_Key (FK)
Date_Key (FK)
Store_Key (FK)
SP_Key (FK)
Promotion_Key (FK)
Ticket_number (FK)
Quantity_sold
Line_amount
Cost_amount
Profit amount
DMDW-12
DMDW-12
46
Discussion
47
Salesperson
SP_Key (PK)
SP attributes
Promotion
Promotion_Key (PK)
Promotion attributes
45
Store
Store_Key (PK)
Store attributes
DMDW-12
Calendar Quarter
Calendar Year-Quarter
Calendar Half Year
Calendar Year
Fiscal Week
Fiscal Week Number in Year
Fiscal Month
Fiscal Month Number in Year
Fiscal Year-Month
Fiscal Quarter
Fiscal Year-Quarter
Fiscal Half Year
Fiscal Year
Holiday Indicator
Weekday Indicator
Selling Season
Major Event
SQL Date Stamp
48
DMDW-12
Product Description
Brand Description
Department Description
Package Size
Diet Type
Weight Units of Measure
Shelf Life Type
Shelf Height
Store Name
Store Number (Natural Key)
Store Street Address
Store City
Store County
Store State
Store Zip Code
Store Manager
Store District
Store Region
Floor Plan Type
Photo Processing Type
Financial Service Type
Selling Square Footage
Total Square Footage
First Open Date
Last Remodel Date
DMDW-12
49
DMDW-12
50
Summary
This course presented the dimensional model
of data warehouses:
Coupon Type
Ad Media Name
Display Provider
Promotion Cost
Promotion Begin Date
Promotion End Date
DMDW-12
51
52
DMDW-12
References
[CS680, 2004] Introduction to Data Warehouses, Drexel Univ. CS
680 Course notes, 2004 (page
https://www.cs.drexel.edu/~dvista/cs680/2.DW.Overview.ppt
visited 2010)
[Kimball, Ross, 2002] Ralph Kimball, Margy Ross - The Data
Warehouse Toolkit, Second Edition, Wiley & Sons, 2002
[Wikipedia] Wikipedia, the free encyclopedia, en.wikipedia.org
53
DMDW-12