You are on page 1of 20

Dimensional Modeling

Confidential L&T

22 Oct 07 |1 |usha

Agenda

Confidential L&T Infotech

Some basics
Why do we need dimension modeling?
Difference between ER / DM
How to start?
Four step Dimensional Design
Types of Grains in Fact Table
About the Modeling Techniques
Slowly Changing Dimension
Some Best Practices

22 Oct 07 |2 |usha v

Question the basics

Some Basics
Fact and dimensions
Fact Table : It is the primary table where the numeric performance measures of
the business are stored
Dimension Tables : These are integral companions to a fact table. They contain
textual descriptors of the business.
A measure (e.g. sales amount, qty, etc) It is numeric measurement in a fact
table.
Each measure depends on a set of dimensions (e.g. sales volume as a function
of product, time, and location)
Each dimension can have a set of associated attributes
For each dimension, the set of associated attributes can be structured as a
hierarchy Normalization and De Normalization

Confidential L&T Infotech

22 Oct 07 |3 |usha v

Example of measures & attributes


Product Dimension

Date Dimension
Date
Month
Year

Store Dimension
StoreID
City
State
Country
Region

es
r
u
as
Me
Confidential L&T Infotech

Sales Fact Table


Date
Product
Store
Customer
unit_sales
dollar_sales

ProductNo
ProdName
ProdDesc
Category
QOH

At
tr
s

ibu

te

Customer Dimension
CustId
CustName
CustCity
CustCountry

schilling_sales

22 Oct 07 |4 |usha v

Examples of dimension hierarchies


Store type
Store

Customer

Confidential L&T Infotech

City

Region

City

State

Country

22 Oct 07 |5 |usha v

ER Modeling vs Dimensional Modeling

Confidential L&T Infotech

ER Model
One table per entity
Minimize data
redundancy
Optimize update
The Transaction
Processing Model

Dimension Modeling
One fact table for data
organization
Maximize
understandability
Optimized for retrieval
The data warehousing
model
Lesser Joins between
tables when compared
with the ER

22 Oct 07 |6 |usha v

Steps leading to modeling


Identify
the
reporting
requiremen
t of the
client

Study the
source
tables
Given by
the client

Apply the
dimensiona
l
techniques
Provide
the model

Confidential L&T Infotech

22 Oct 07 |7 |usha v

Four Step Modeling Process

Confidential L&T Infotech

Choose the Data Mart


Declare the Grain
Choose the Dimensions
Choose the Facts

22 Oct 07 |8 |usha v

Types of Grains
The TRANSACTION grain,

-represents a point in space and


time
The PERIODIC SNAPSHOT grain,

-represents a regular span of


time repeated over and over and
The ACCUMULATING SNAPSHOT grain,

-represents the entire life of an


entity.

Confidential L&T Infotech

22 Oct 07 |9 |usha v

Modeling Techniques
Star Model View

A single object (fact table) in the middle connected to a number of


dimension tables

Snow Flake View

A refinement of star schema where the dimensional hierarchy is


represented explicitly by normalizing the dimension tables

Fact Less Fact View


Bridge View

Confidential L&T Infotech

22 Oct 07 |10 |usha v

Slowly Changing Dimensions


Type 1 (Update)
Type 2 (New record)
Type 3 (New attribute)

Confidential L&T Infotech

22 Oct 07 |11 |usha v

Best Practices

Confidential L&T Infotech

Avoid null keys in fact tables


Dont normalize dimension, fact tables
Join between dimension and fact tables in data
warehouse should be on surrogate keys ( not
operational codes)
Refer Kimballs Dimensional techniques
www.kimball.com
http://www.dbmsmag.com

22 Oct 07 |12 |usha v

Star Model
Product_ Dim
Product_Id
Other Descriptors

Customer_Dim
Sales Fact

Customer_Id
Other Descriptors

Customer_Id
Product_Id
Representative_Id
Date_Id
Quantity_Sold
Sales_Amount

Confidential L&T Infotech

Date_Dim

Representative_Dim

Date_Id
Other Descriptors

Representative_Id
Other Descriptors

22 Oct 07 |13 |usha v

Star Schema with data


product

prodId
p1
p2

name price
bolt
10
nut
5

sale oderId date


o100 1/7/97
o102 2/7/97
o105 3/8/97

customer

Confidential L&T Infotech

custId
53
81
111

store

custId
53
53
111

name
joe
fred
sally

prodId
p1
p2
p1

storeId
c1
c1
c3

address
10 main
12 main
80 willow

qty
1
2
5

storeId
c1
c2
c3

city
nyc
sfo
la

amt
12
11
50

city
sfo
sfo
la

22 Oct 07 |14 |usha v

Multidimensional Cube
Fact relation
sale

Product Client
p1
c1
p2
c1
p1
c3
p2
c2
p1
c1
p1
c2

Date
1
1
1
1
2
2

3-dimensional cube
Amt
12
11
50
8
44
4

day 2
day 1

p1
p2 c1
p1
12
p2
11

c1
44

c2
4
c2

c3
c3
50

Back
Confidential L&T Infotech

22 Oct 07 |15 |usha v

Snow Flakes Model


Customer_Dim

Product_ Dim
Product_Id
Other Descriptors

Sales Fact
Customer_Id
Product_Id
Representative_Id
Date_Id
Quantity_Sold
Sales_Amount

Customer_Id
Country_Id
Other Descriptors

Country_Dim
Country_Id
Other Descriptors

Date_Dim

Representative_Dim

Date_Id
Other Descriptors

Representative_Id
Other Descriptors
Back

Confidential L&T Infotech

22 Oct 07 |16 |usha v

Bridge Table
Diagnosis Group Helper Table
Patient Billing Fact Table
Date_Key
Patient_Key
Doctor_Key
Service_Key
Diagnosis_Group
Billed_Amount

Diagnosis_Group
Diagnosis_Key
Weighting factor

Diagnosis Dimension
Diagnosis_Key
Description
Type
Category

Confidential L&T Infotech

22 Oct 07 |17 |usha v

Bridge Table (contd.)


Student_Term_ Dim
Student_Term _Id
Other Descriptors

Date_Dim

Student Course to Faculty_Dim


Student Course Fact
StudentFacultyBridge_Id
Student_Term_Id
StudentLocationBridge_Id
Institution_Id
Date_Id

StudentFacultyBridge_Id
Faculty_Id
Other Descriptors

Date_Id
Other Descriptors

Faculty_Dim
Faculty_Id
Other Descriptors

Location_Dim

Confidential L&T Infotech

Institution_Dim

Student Course to Location_Dim

Institution_Id
Other Descriptors

StudentLocationBridge_Id
Location_Id
Other Descriptors

Location_Id
Other Descriptors

Back

22 Oct 07 |18 |usha v

Factless Fact
Requirement Dim

Requirement Fact

Technology Dim

SBU Dim

Date Dim

Interview Fact
Candidate Dim

Source Dim

Status Dim

Accept/Decline Dim

Confidential L&T Infotech

Interview Dim

Reasons Dim

22 Oct 07 |19 |usha v

Thank You

You might also like