Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Surrogate Key vs Natural Key DImension Tables Dimensional Model Expand / Collapse
Author
Message
Posted Saturday, March 24, 2012 4:15 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 8:03 AM
Points: 4,052, Visits: 4,192
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/

Post #1272280
Posted Sunday, March 25, 2012 12:33 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 3:29 PM
Points: 429, Visits: 3,084
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.


David
Post #1272376
Posted Sunday, March 25, 2012 12:49 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 8:15 AM
Points: 3,068, Visits: 4,639
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.
Post #1272378
Posted Sunday, March 25, 2012 1:00 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 8:03 AM
Points: 4,052, Visits: 4,192
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/

Post #1272381
Posted Thursday, July 19, 2012 11:34 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 2:46 AM
Points: 1,371, Visits: 1,547
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

Post #1332420
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse