SlideShare a Scribd company logo
Slowly Changing Dimensions
SCD overview
In the real world, the business does not remain static over time;
products change size and weight, customers relocate, stores change
layouts, and sales staff are assigned to different locations. Most
systems of record keep only the current values for business subjects
(e.g., the current customer address). An operational data store keeps
only a short history of changes to indicate that changes have occurred
and to support business processes handling the immediate changes.
In a data warehouse or data mart, we need to know the history of
values to match the history of facts with the correct dimensional
descriptions at the time the facts happened.
For example,
We need to associate a sales fact with the description of the associated
customer during the time period of the sales fact, which may not be
the description of that customer today. Of course, business subjects
change slowly compared with most transactional data (e.g., inventory
level).
Three ways for handling SCD attributes
1. Overwrite the current value with the new value. (Type1)
2. For each dimension attribute that changes, create a current value
field and as many old value fields as we wish (i.e., a multivalued
attribute with a fixed number of occurrences for a limited historical
view). (Type 3)
3. Create a new dimension table row (with a new surrogate key) each
time the dimension object changes; this new row contains all the
dimension characteristics at the time of the change; the new
surrogate key is the original surrogate key plus the start date for the
period when these dimension values are in effect. (Type 2)
Example of Type 2 SCD Customer dimension
table
Example of Type 2 SCD Customer dimension
table (cont…)
Finding the dimension row for a fact row is a little more complex; the
SQL WHERE clause would include the following:
WHERE Fact.CustomerKey = Customer.CustomerKey AND
Fact.DateKey BETWEEN Customer.StartDate and Customer.EndDate
Note:
Type 2 SCD can cause an excessive number of dimension table rows
when dimension objects frequently change or when dimension rows
are large “monster dimensions.” Also, if only a small portion of the
dimension row has changing values, there are excessive redundant data
created.
The solution for that is dimension segmentation.
Dimension Segmentation
A dimension is segmented into two dimension tables; one segment
may hold nearly constant or very slowly changing dimensions and other
segments hold clusters of attributes that change more rapidly and, for
attributes in the same cluster, often change at the same time. These
more rapidly changing attributes are often called “hot” attributes by
data warehouse designers.
Example of Dimension Segmentation
Determining Dimensions and Facts
1. What were the dollar sales of health and beauty products in North
America to customers over the age of 50 in each of the past three
years?
2. What is the name of the salesperson who had the highest dollar
sales of each product in the first quarter of this year?
3. How many European customer complaints did we receive on pet
food products during the past year? How has it changed from month to
month this year?
4. What is the name of the stores that had the highest average monthly
quantity sales of casual clothing during the summer?
Fact-qualifier matrix for sales and customer
service tracking
Star schema for sales and customer service
tracking
Ten Essential Rules of Dimensional Modeling
1. Use atomic facts: Eventually, users want detailed data, even if their initial
requests are for summarized facts.
2. Create single-process fact tables: Each fact table should address the important
measurements for one business process, such as taking a customer order or placing
a material purchase order.
3. Include a date dimension for every fact table: A fact should be described by the
characteristics of the associated day (or finer) date/time to which that fact is
related.
4. Enforce consistent grain: Each measurement in a fact table must be atomic for
the same combination of keys (the same grain).
5. Disallow null keys in fact tables: Facts apply to the combination of key values,
and helper tables may be needed to represent some M:N relationships.
Ten Essential Rules of Dimensional
Modeling(cont…)
6. Honor hierarchies: Understand the hierarchies of dimensions and carefully choose to
snowflake the hierarchy or denormalize into one dimension.
7. Decode dimension tables: Store descriptions of surrogate keys and codes used in fact
tables in associated dimension tables, which can then be used to report labels and query
filters.
8. Use surrogate keys: All dimension table rows should be identified by a surrogate key,
with descriptive columns showing the associated production and source system keys.
9. Conform dimensions: Conformed dimensions should be used across multiple fact tables.
10. Balance requirements with actual data: Unfortunately, source data may not precisely
support all business requirements, so you must balance what is technically possible with
what users want and need.
Role of MetaData
The metadata associated with data marts are often referred to as a
“data catalog,” “data directory,” or some similar term. Metadata serve
as kind of a “yellow pages” directory to the data in the data marts. The
metadata should allow users to easily answer questions such as the
following:
Role of MetaData (cont…)
1. What subjects are described in the data mart? (Typical subjects are customers,
patients, students, products, courses, and so on.)
2. What dimensions and facts are included in the data mart? What is the grain of the
fact table?
3. How are the data in the data mart derived from the enterprise data warehouse
data? What rules are used in the derivation?
4. How are the data in the enterprise data warehouse derived from operational data?
What rules are used in this derivation?
5. What reports and predefined queries are available to view the data?
6. What drill-down and other data analysis techniques are available?
7. Who is responsible for the quality of data in the data marts, and to whom are requests
for changes made?
SQL OLAP Querying
Question:
Which customer has bought the most of each product we sell? Show
the product ID and description, customer ID and name, and the total
quantity sold of that product to that customer; show the results in
sequence by product ID.
Query:
SELECT P1.ProductId, ProductDescription, C1.CustomerId,
CustomerName,SUM(OL1.OrderedQuantity) AS TotOrdered FROM
Customer_T AS C1, Product_T AS P1, OrderLine_T AS OL1, Order_T AS
O1 WHERE C1.CustomerId = O1.CustomerId AND O1.OrderId =
OL1.OrderId AND OL1.ProductId = P1.ProductId GROUP BY
P1.ProductId, ProductDescription, C1.CustomerId, CustomerName
HAVING TotOrdered >= ALL (SELECT SUM(OL2.OrderedQuantity) FROM
OrderLine_T AS OL2, Order_T AS O2 WHERE OL2.ProductId =
P1.ProductId AND OL2.OrderId = O2.OrderId AND O2.CustomerId <>
C1.CustomerId GROUP BY O2.CustomerId) ORDER BY P1.ProductId;
Ad

More Related Content

What's hot (20)

Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
ASHOK KUMAR PALAKI
 
Sequence Diagram
Sequence DiagramSequence Diagram
Sequence Diagram
University of Texas at Dallas
 
Chapter20 object oriented analysis and design
Chapter20 object oriented analysis and designChapter20 object oriented analysis and design
Chapter20 object oriented analysis and design
Dhani Ahmad
 
Use Case Modeling
Use Case ModelingUse Case Modeling
Use Case Modeling
Venkat Srinivasan
 
DDD - 2 - Domain Driven Design: Tactical design.pdf
DDD - 2 - Domain Driven Design: Tactical design.pdfDDD - 2 - Domain Driven Design: Tactical design.pdf
DDD - 2 - Domain Driven Design: Tactical design.pdf
Eleonora Ciceri
 
Lecture6 activity diagrams
Lecture6 activity diagramsLecture6 activity diagrams
Lecture6 activity diagrams
Shahid Riaz
 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
Lilia Sfaxi
 
Dbms Interview Question And Answer
Dbms Interview Question And AnswerDbms Interview Question And Answer
Dbms Interview Question And Answer
Jagan Mohan Bishoyi
 
Collaboration Diagram
Collaboration DiagramCollaboration Diagram
Collaboration Diagram
fahad_uaar
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
Jafar Nesargi
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbols
Kumar
 
Ch7 implementation
Ch7 implementationCh7 implementation
Ch7 implementation
software-engineering-book
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
Ashesh R
 
Quality attributes in software architecture
Quality attributes in software architectureQuality attributes in software architecture
Quality attributes in software architecture
Himanshu
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
ssuser2d043c
 
CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3
Gobinath Subramaniam
 
6 modeling system requirements
6 modeling system requirements6 modeling system requirements
6 modeling system requirements
ricardovigan
 
Modelo de datos semantico
Modelo de datos semanticoModelo de datos semantico
Modelo de datos semantico
clasetic2011
 
SE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMSE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAM
Amr E. Mohamed
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
paramisoft
 
Chapter20 object oriented analysis and design
Chapter20 object oriented analysis and designChapter20 object oriented analysis and design
Chapter20 object oriented analysis and design
Dhani Ahmad
 
DDD - 2 - Domain Driven Design: Tactical design.pdf
DDD - 2 - Domain Driven Design: Tactical design.pdfDDD - 2 - Domain Driven Design: Tactical design.pdf
DDD - 2 - Domain Driven Design: Tactical design.pdf
Eleonora Ciceri
 
Lecture6 activity diagrams
Lecture6 activity diagramsLecture6 activity diagrams
Lecture6 activity diagrams
Shahid Riaz
 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
Lilia Sfaxi
 
Dbms Interview Question And Answer
Dbms Interview Question And AnswerDbms Interview Question And Answer
Dbms Interview Question And Answer
Jagan Mohan Bishoyi
 
Collaboration Diagram
Collaboration DiagramCollaboration Diagram
Collaboration Diagram
fahad_uaar
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
Jafar Nesargi
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbols
Kumar
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
Ashesh R
 
Quality attributes in software architecture
Quality attributes in software architectureQuality attributes in software architecture
Quality attributes in software architecture
Himanshu
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
ssuser2d043c
 
6 modeling system requirements
6 modeling system requirements6 modeling system requirements
6 modeling system requirements
ricardovigan
 
Modelo de datos semantico
Modelo de datos semanticoModelo de datos semantico
Modelo de datos semantico
clasetic2011
 
SE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMSE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAM
Amr E. Mohamed
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
paramisoft
 

Similar to (Lecture 4)Slowly Changing Dimensions.pdf (20)

Introduction to Dimesional Modelling
Introduction to Dimesional ModellingIntroduction to Dimesional Modelling
Introduction to Dimesional Modelling
Ashish Chandwani
 
Data modelling interview question
Data modelling interview questionData modelling interview question
Data modelling interview question
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
Data Warehousing and Data Mining
Data Warehousing and Data MiningData Warehousing and Data Mining
Data Warehousing and Data Mining
idnats
 
Datawarehouse Overview
Datawarehouse OverviewDatawarehouse Overview
Datawarehouse Overview
ashok kumar
 
Modelado Dimensional 4 Etapas
Modelado Dimensional 4 EtapasModelado Dimensional 4 Etapas
Modelado Dimensional 4 Etapas
Roberto Espinosa
 
Slowly changing dimension
Slowly changing dimension Slowly changing dimension
Slowly changing dimension
Sunita Sahu
 
Data warehouse logical design
Data warehouse logical designData warehouse logical design
Data warehouse logical design
Er. Nawaraj Bhandari
 
Intro to Data warehousing lecture 13
Intro to Data warehousing   lecture 13Intro to Data warehousing   lecture 13
Intro to Data warehousing lecture 13
AnwarrChaudary
 
Lecture 3:Introduction to Dimensional Modelling.pptx
Lecture 3:Introduction to Dimensional Modelling.pptxLecture 3:Introduction to Dimensional Modelling.pptx
Lecture 3:Introduction to Dimensional Modelling.pptx
RehmahAtugonza
 
OLAP Cubes in Datawarehousing
OLAP Cubes in DatawarehousingOLAP Cubes in Datawarehousing
OLAP Cubes in Datawarehousing
Prithwis Mukerjee
 
(Lecture 3) Star Schema.pdf
(Lecture 3) Star Schema.pdf(Lecture 3) Star Schema.pdf
(Lecture 3) Star Schema.pdf
MobeenMasoudi
 
Dimensional Modeling
Dimensional ModelingDimensional Modeling
Dimensional Modeling
Sunita Sahu
 
Modelado Dimensional 4 etapas.ppt
Modelado Dimensional 4 etapas.pptModelado Dimensional 4 etapas.ppt
Modelado Dimensional 4 etapas.ppt
ssuser39e08e
 
Data Warehousing for students educationpptx
Data Warehousing for students educationpptxData Warehousing for students educationpptx
Data Warehousing for students educationpptx
jainyshah20
 
Designing the business process dimensional model
Designing the business process dimensional modelDesigning the business process dimensional model
Designing the business process dimensional model
Gersiton Pila Challco
 
DWH DWH DWH DWH DWH DWH DWH DWH- QP.pptx
DWH DWH DWH DWH DWH DWH DWH DWH- QP.pptxDWH DWH DWH DWH DWH DWH DWH DWH- QP.pptx
DWH DWH DWH DWH DWH DWH DWH DWH- QP.pptx
pandaonlineservice25
 
BI Suite Overview
BI Suite OverviewBI Suite Overview
BI Suite Overview
Bruno Saraiva
 
Date Analysis .pdf
Date Analysis .pdfDate Analysis .pdf
Date Analysis .pdf
ABDEL RAHMAN KARIM
 
An introduction to data warehousing
An introduction to data warehousingAn introduction to data warehousing
An introduction to data warehousing
Shahed Khalili
 
Dimensional Modeling
Dimensional ModelingDimensional Modeling
Dimensional Modeling
Bryan Cafferky
 
Introduction to Dimesional Modelling
Introduction to Dimesional ModellingIntroduction to Dimesional Modelling
Introduction to Dimesional Modelling
Ashish Chandwani
 
Data Warehousing and Data Mining
Data Warehousing and Data MiningData Warehousing and Data Mining
Data Warehousing and Data Mining
idnats
 
Datawarehouse Overview
Datawarehouse OverviewDatawarehouse Overview
Datawarehouse Overview
ashok kumar
 
Modelado Dimensional 4 Etapas
Modelado Dimensional 4 EtapasModelado Dimensional 4 Etapas
Modelado Dimensional 4 Etapas
Roberto Espinosa
 
Slowly changing dimension
Slowly changing dimension Slowly changing dimension
Slowly changing dimension
Sunita Sahu
 
Intro to Data warehousing lecture 13
Intro to Data warehousing   lecture 13Intro to Data warehousing   lecture 13
Intro to Data warehousing lecture 13
AnwarrChaudary
 
Lecture 3:Introduction to Dimensional Modelling.pptx
Lecture 3:Introduction to Dimensional Modelling.pptxLecture 3:Introduction to Dimensional Modelling.pptx
Lecture 3:Introduction to Dimensional Modelling.pptx
RehmahAtugonza
 
OLAP Cubes in Datawarehousing
OLAP Cubes in DatawarehousingOLAP Cubes in Datawarehousing
OLAP Cubes in Datawarehousing
Prithwis Mukerjee
 
(Lecture 3) Star Schema.pdf
(Lecture 3) Star Schema.pdf(Lecture 3) Star Schema.pdf
(Lecture 3) Star Schema.pdf
MobeenMasoudi
 
Dimensional Modeling
Dimensional ModelingDimensional Modeling
Dimensional Modeling
Sunita Sahu
 
Modelado Dimensional 4 etapas.ppt
Modelado Dimensional 4 etapas.pptModelado Dimensional 4 etapas.ppt
Modelado Dimensional 4 etapas.ppt
ssuser39e08e
 
Data Warehousing for students educationpptx
Data Warehousing for students educationpptxData Warehousing for students educationpptx
Data Warehousing for students educationpptx
jainyshah20
 
Designing the business process dimensional model
Designing the business process dimensional modelDesigning the business process dimensional model
Designing the business process dimensional model
Gersiton Pila Challco
 
DWH DWH DWH DWH DWH DWH DWH DWH- QP.pptx
DWH DWH DWH DWH DWH DWH DWH DWH- QP.pptxDWH DWH DWH DWH DWH DWH DWH DWH- QP.pptx
DWH DWH DWH DWH DWH DWH DWH DWH- QP.pptx
pandaonlineservice25
 
An introduction to data warehousing
An introduction to data warehousingAn introduction to data warehousing
An introduction to data warehousing
Shahed Khalili
 
Ad

More from MobeenMasoudi (14)

Purpose the of Process Modeling.pptx
Purpose the of Process Modeling.pptxPurpose the of Process Modeling.pptx
Purpose the of Process Modeling.pptx
MobeenMasoudi
 
Purpose of Process Modeling.pptx
Purpose of Process Modeling.pptxPurpose of Process Modeling.pptx
Purpose of Process Modeling.pptx
MobeenMasoudi
 
Process Modeling.pptx
Process Modeling.pptxProcess Modeling.pptx
Process Modeling.pptx
MobeenMasoudi
 
Flow Charting – Disadvantages.pptx
Flow Charting – Disadvantages.pptxFlow Charting – Disadvantages.pptx
Flow Charting – Disadvantages.pptx
MobeenMasoudi
 
Commonly Used Process Modeling Notations.pptx
Commonly Used Process Modeling Notations.pptxCommonly Used Process Modeling Notations.pptx
Commonly Used Process Modeling Notations.pptx
MobeenMasoudi
 
BPModeling1.pptx
BPModeling1.pptxBPModeling1.pptx
BPModeling1.pptx
MobeenMasoudi
 
BPMN 2.pptx
BPMN 2.pptxBPMN 2.pptx
BPMN 2.pptx
MobeenMasoudi
 
chapter1.pptx
chapter1.pptxchapter1.pptx
chapter1.pptx
MobeenMasoudi
 
(Lecture 5)OLAP Querying.pdf
(Lecture 5)OLAP Querying.pdf(Lecture 5)OLAP Querying.pdf
(Lecture 5)OLAP Querying.pdf
MobeenMasoudi
 
Data Warehousing Overview.pptx
Data Warehousing Overview.pptxData Warehousing Overview.pptx
Data Warehousing Overview.pptx
MobeenMasoudi
 
Himmatullah Ferozee Assingnment.pptx
Himmatullah Ferozee Assingnment.pptxHimmatullah Ferozee Assingnment.pptx
Himmatullah Ferozee Assingnment.pptx
MobeenMasoudi
 
E-A Assessing the value of enterprise architecture.pptx
E-A Assessing the value of enterprise architecture.pptxE-A Assessing the value of enterprise architecture.pptx
E-A Assessing the value of enterprise architecture.pptx
MobeenMasoudi
 
(Lecture 2)Data Warehouse Architecture.pdf
(Lecture 2)Data Warehouse Architecture.pdf(Lecture 2)Data Warehouse Architecture.pdf
(Lecture 2)Data Warehouse Architecture.pdf
MobeenMasoudi
 
(Lecture 1)Data Warehousing Overview.pdf
(Lecture 1)Data Warehousing Overview.pdf(Lecture 1)Data Warehousing Overview.pdf
(Lecture 1)Data Warehousing Overview.pdf
MobeenMasoudi
 
Purpose the of Process Modeling.pptx
Purpose the of Process Modeling.pptxPurpose the of Process Modeling.pptx
Purpose the of Process Modeling.pptx
MobeenMasoudi
 
Purpose of Process Modeling.pptx
Purpose of Process Modeling.pptxPurpose of Process Modeling.pptx
Purpose of Process Modeling.pptx
MobeenMasoudi
 
Process Modeling.pptx
Process Modeling.pptxProcess Modeling.pptx
Process Modeling.pptx
MobeenMasoudi
 
Flow Charting – Disadvantages.pptx
Flow Charting – Disadvantages.pptxFlow Charting – Disadvantages.pptx
Flow Charting – Disadvantages.pptx
MobeenMasoudi
 
Commonly Used Process Modeling Notations.pptx
Commonly Used Process Modeling Notations.pptxCommonly Used Process Modeling Notations.pptx
Commonly Used Process Modeling Notations.pptx
MobeenMasoudi
 
(Lecture 5)OLAP Querying.pdf
(Lecture 5)OLAP Querying.pdf(Lecture 5)OLAP Querying.pdf
(Lecture 5)OLAP Querying.pdf
MobeenMasoudi
 
Data Warehousing Overview.pptx
Data Warehousing Overview.pptxData Warehousing Overview.pptx
Data Warehousing Overview.pptx
MobeenMasoudi
 
Himmatullah Ferozee Assingnment.pptx
Himmatullah Ferozee Assingnment.pptxHimmatullah Ferozee Assingnment.pptx
Himmatullah Ferozee Assingnment.pptx
MobeenMasoudi
 
E-A Assessing the value of enterprise architecture.pptx
E-A Assessing the value of enterprise architecture.pptxE-A Assessing the value of enterprise architecture.pptx
E-A Assessing the value of enterprise architecture.pptx
MobeenMasoudi
 
(Lecture 2)Data Warehouse Architecture.pdf
(Lecture 2)Data Warehouse Architecture.pdf(Lecture 2)Data Warehouse Architecture.pdf
(Lecture 2)Data Warehouse Architecture.pdf
MobeenMasoudi
 
(Lecture 1)Data Warehousing Overview.pdf
(Lecture 1)Data Warehousing Overview.pdf(Lecture 1)Data Warehousing Overview.pdf
(Lecture 1)Data Warehousing Overview.pdf
MobeenMasoudi
 
Ad

Recently uploaded (20)

Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)
samueljackson3773
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)
samueljackson3773
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 

(Lecture 4)Slowly Changing Dimensions.pdf

  • 2. SCD overview In the real world, the business does not remain static over time; products change size and weight, customers relocate, stores change layouts, and sales staff are assigned to different locations. Most systems of record keep only the current values for business subjects (e.g., the current customer address). An operational data store keeps only a short history of changes to indicate that changes have occurred and to support business processes handling the immediate changes. In a data warehouse or data mart, we need to know the history of values to match the history of facts with the correct dimensional descriptions at the time the facts happened.
  • 3. For example, We need to associate a sales fact with the description of the associated customer during the time period of the sales fact, which may not be the description of that customer today. Of course, business subjects change slowly compared with most transactional data (e.g., inventory level).
  • 4. Three ways for handling SCD attributes 1. Overwrite the current value with the new value. (Type1) 2. For each dimension attribute that changes, create a current value field and as many old value fields as we wish (i.e., a multivalued attribute with a fixed number of occurrences for a limited historical view). (Type 3) 3. Create a new dimension table row (with a new surrogate key) each time the dimension object changes; this new row contains all the dimension characteristics at the time of the change; the new surrogate key is the original surrogate key plus the start date for the period when these dimension values are in effect. (Type 2)
  • 5. Example of Type 2 SCD Customer dimension table
  • 6. Example of Type 2 SCD Customer dimension table (cont…) Finding the dimension row for a fact row is a little more complex; the SQL WHERE clause would include the following: WHERE Fact.CustomerKey = Customer.CustomerKey AND Fact.DateKey BETWEEN Customer.StartDate and Customer.EndDate
  • 7. Note: Type 2 SCD can cause an excessive number of dimension table rows when dimension objects frequently change or when dimension rows are large “monster dimensions.” Also, if only a small portion of the dimension row has changing values, there are excessive redundant data created. The solution for that is dimension segmentation.
  • 8. Dimension Segmentation A dimension is segmented into two dimension tables; one segment may hold nearly constant or very slowly changing dimensions and other segments hold clusters of attributes that change more rapidly and, for attributes in the same cluster, often change at the same time. These more rapidly changing attributes are often called “hot” attributes by data warehouse designers.
  • 9. Example of Dimension Segmentation
  • 10. Determining Dimensions and Facts 1. What were the dollar sales of health and beauty products in North America to customers over the age of 50 in each of the past three years? 2. What is the name of the salesperson who had the highest dollar sales of each product in the first quarter of this year? 3. How many European customer complaints did we receive on pet food products during the past year? How has it changed from month to month this year? 4. What is the name of the stores that had the highest average monthly quantity sales of casual clothing during the summer?
  • 11. Fact-qualifier matrix for sales and customer service tracking
  • 12. Star schema for sales and customer service tracking
  • 13. Ten Essential Rules of Dimensional Modeling 1. Use atomic facts: Eventually, users want detailed data, even if their initial requests are for summarized facts. 2. Create single-process fact tables: Each fact table should address the important measurements for one business process, such as taking a customer order or placing a material purchase order. 3. Include a date dimension for every fact table: A fact should be described by the characteristics of the associated day (or finer) date/time to which that fact is related. 4. Enforce consistent grain: Each measurement in a fact table must be atomic for the same combination of keys (the same grain). 5. Disallow null keys in fact tables: Facts apply to the combination of key values, and helper tables may be needed to represent some M:N relationships.
  • 14. Ten Essential Rules of Dimensional Modeling(cont…) 6. Honor hierarchies: Understand the hierarchies of dimensions and carefully choose to snowflake the hierarchy or denormalize into one dimension. 7. Decode dimension tables: Store descriptions of surrogate keys and codes used in fact tables in associated dimension tables, which can then be used to report labels and query filters. 8. Use surrogate keys: All dimension table rows should be identified by a surrogate key, with descriptive columns showing the associated production and source system keys. 9. Conform dimensions: Conformed dimensions should be used across multiple fact tables. 10. Balance requirements with actual data: Unfortunately, source data may not precisely support all business requirements, so you must balance what is technically possible with what users want and need.
  • 15. Role of MetaData The metadata associated with data marts are often referred to as a “data catalog,” “data directory,” or some similar term. Metadata serve as kind of a “yellow pages” directory to the data in the data marts. The metadata should allow users to easily answer questions such as the following:
  • 16. Role of MetaData (cont…) 1. What subjects are described in the data mart? (Typical subjects are customers, patients, students, products, courses, and so on.) 2. What dimensions and facts are included in the data mart? What is the grain of the fact table? 3. How are the data in the data mart derived from the enterprise data warehouse data? What rules are used in the derivation? 4. How are the data in the enterprise data warehouse derived from operational data? What rules are used in this derivation? 5. What reports and predefined queries are available to view the data? 6. What drill-down and other data analysis techniques are available? 7. Who is responsible for the quality of data in the data marts, and to whom are requests for changes made?
  • 17. SQL OLAP Querying Question: Which customer has bought the most of each product we sell? Show the product ID and description, customer ID and name, and the total quantity sold of that product to that customer; show the results in sequence by product ID.
  • 18. Query: SELECT P1.ProductId, ProductDescription, C1.CustomerId, CustomerName,SUM(OL1.OrderedQuantity) AS TotOrdered FROM Customer_T AS C1, Product_T AS P1, OrderLine_T AS OL1, Order_T AS O1 WHERE C1.CustomerId = O1.CustomerId AND O1.OrderId = OL1.OrderId AND OL1.ProductId = P1.ProductId GROUP BY P1.ProductId, ProductDescription, C1.CustomerId, CustomerName HAVING TotOrdered >= ALL (SELECT SUM(OL2.OrderedQuantity) FROM OrderLine_T AS OL2, Order_T AS O2 WHERE OL2.ProductId = P1.ProductId AND OL2.OrderId = O2.OrderId AND O2.CustomerId <> C1.CustomerId GROUP BY O2.CustomerId) ORDER BY P1.ProductId;