Download presentation
Presentation is loading. Please wait.
1
Simple tips for better data warehouse design
Michael Johnson
2
About me Michael Johnson Johannesburg SQL User Group Lead
@MikeJohnsonZA
3
What we will cover: Use surrogate keys One Fact table per process
Aesthetics Indexing Q & A
4
Primer What is Dimensional modelling
5
Primer What is Dimensional modelling Date Dimension Fact Sales Person
Region Dimension Product Dimension
6
Lets begin
7
#1 - Use Surrogate Keys Employee Number Employee Name Department …
John Smith Finance EMP0005 Peter Jackson Sales TMP0003 Mary Robins Marketing Time sheets number Employee Number Date Hours … 2016JAN01 EMP0001 1 Jan 2016 8 2016JAN02 EMP0005 2016JAN03 TMP0003 10.5
8
#1 - Use Surrogate Keys Reduce the size of fact tables
9
#1 - Use Surrogate Keys Employee Key Employee Number Employee Name
Department … 1 EMP0001 John Smith Finance 2 EMP0005 Peter Jackson Sales 3 TMP0003 Mary Robins Marketing Time sheets number Employee Key Date Hours … 1 8 2 3 10.5
10
#1 - Use Surrogate Keys Star join optimisation
11
#1 - Use Surrogate Keys Allow Slowly change Dimensions Employee Key
Effective date Expiry date Employee Number Employee Name Department … 1 EMP0001 John Smith Finance 2 EMP0005 Peter Jackson Sales 3 TMP0003 Mary Robins Marketing
12
#1 - Use Surrogate Keys Allow Slowly change Dimensions Employee Key
Effective date Expiry date Employee Number Employee Name Department … 1 EMP0001 John Smith Finance 2 EMP0005 Peter Jackson Sales 3 TMP0003 Mary Robins Marketing 4 Time sheets number Employee Key Date Hours … 1 8 2642 4 11
13
One fact table per process
14
One fact table per process
Time Sheet Key Employee Key Date Key Hours 123456 201 8
15
One fact table per process
Time Sheet Key Employee Key Date Key Hours Rate Amount 123456 201 8 100 800 Time Sheet Key Employee Key Date Key Invoice Key Hours Rate Amount 123456 201 1 8 100 800
17
One fact table per process
Time Sheet Key Employee Key Date Key Invoice Key Hours Rate Amount 123456 201 1 8 100 800 2 -100 -800
18
One fact table per process
Time Sheet Key Employee Key Date Key Invoice Key Hours Rate Amount 123456 201 1 8 100 800 2 -100
19
One fact table per process
Time Sheet Key Employee Key Date Key Invoice Key Hours Rate Amount 123456 201 1 8 100 800 2 -100 -800
20
Aesthetics
21
Naming – Use descriptive names
[OrdQty] VS [Order Quantity]
22
Naming – don’t use legacy naming conventions
[Tbl_fact_sales] VS [Sales]
23
[DBO].[Fact_Orders] VS [Fact].[Orders]
Naming – Use schemas [DBO].[Fact_Orders] VS [Fact].[Orders]
24
Use foreign keys but disable them
25
Quick Demo
26
Indexing fact tables
27
Indexing fact tables
29
Thank you A big thank you to our sponsors, without them days like today would not happen.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.