SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Surrogate Key vs Natural Key DImension Tables Dimensional Model


Surrogate Key vs Natural Key DImension Tables Dimensional Model

Author
Message
Welsh Corgi
Welsh Corgi
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26896 Visits: 4895
Could someone please help me explain to a nontechnical person why it is bad practice to use the Natural Keys from the source systems as the Primary key that relates to the Fact Table?

I appreciate any input on this topic.

For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
sqlvogel
sqlvogel
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2096 Visits: 3706
Welsh Corgi (3/24/2012)
Could someone please help me explain to a nontechnical person why it is bad practice to use the Natural Keys from the source systems as the Primary key that relates to the Fact Table?


I generally prefer the term "business key" instead of natural key but it means the same thing.

If the dimension table has to preserve history then the business key of that table would have to include a date (or perhaps a version number). The dates in the fact table won't necessarily match the dates in the key of all the tables it references. So you'd have to add additional dates or version numbers for every table being referenced and use a compound key for all those references. Or you could do without the foreign keys at all and make every join based on a date range query rather than just straight equality. Both options are possible but do add a certain amount of complexity in most cases.

Having a surrogate key can also help you track changes to business key values or changes to the keys themselves.

Surrogate keys aren't necessarily essential in a data warehouse but they typically do help simplify joins in marts for presentation/reporting purposes.
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14135 Visits: 4639
Welsh Corgi (3/24/2012)
Could someone please help me explain to a nontechnical person why it is bad practice to use the Natural Keys from the source systems as the Primary key that relates to the Fact Table?

I appreciate any input on this topic.


Not really easy to explain this to a non-technical person; at the end of the day you will have to say - in a polite way - that there are best practices on the industry and the company hired you to apply such best practices.

Having said that, IBM has done a good job detailing the main reason why to use surrogate keys on dimensional modeling, please check http://publib.boulder.ibm.com/infocenter/rdahelp/v7r5/index.jsp?topic=%2Fcom.ibm.datatools.dimensional.ui.doc%2Ftopics%2Fc_dm_surrogatekeys.html

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Welsh Corgi
Welsh Corgi
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26896 Visits: 4895
Thank you.

For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Lokesh Vij
Lokesh Vij
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3310 Visits: 1599
Friend, for details check the book -->
SQL Server MVP Deep Dives, Volume 2
PART 1 ARCHITECTURE EDITED BY LOUIS DAVIDSON
1. Where are my keys? by AMI LEVIN

http://www.manning.com/delaney/

~ Lokesh Vij

Guidelines for quicker answers on T-SQL question
Guidelines for answers on Performance questions

Link to my Blog Post --> www.SQLPathy.com

Follow me @Twitter


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search