dbTalk Databases Forums  

Primary Key for Dimension Tables in AdventureWorksDW

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Primary Key for Dimension Tables in AdventureWorksDW in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark
 
Posts: n/a

Default Primary Key for Dimension Tables in AdventureWorksDW - 12-26-2006 , 03:37 PM






Hello,

just one question about the AdventureWorksDB sample database: Why are there
"artificial" primary keys such as TimeKey and AccountKey which start from 1?
Is there any reason not to use the date, for example 1/1/2004, or the
specific account number, as primary key?
TimeKey FullDateAlternateKey DayNumberOfWeek
915 1/1/2004 5
916 1/2/2004 6
917 1/3/2004 7
918 1/4/2004 1


Thanks.

Mark




Reply With Quote
  #2  
Old   
Jeje
 
Posts: n/a

Default Re: Primary Key for Dimension Tables in AdventureWorksDW - 12-26-2006 , 05:03 PM






they use identify columns.
So the counter starts at 1.

in a standard DW system generally we use an integer instead of a date/time
for the time dimension for performance reason.
for other dimensions, using a surrogatekey give some advantages. Specially
if your source system use characters has a key. Also, surrogatekeys allow
you to load data from multiple sources where you'll have the same account
number, using surrogate keys you can create 2 keys (1 by source).
again, using integer improve performance and storage.

when you have only 1 source where the codes are integers and you don't have
slow changing dimensions, then you can use the source key instead of a
surrogate key.

remember the adv. works is a sample based on standard best practices for a
DW structure.

"Mark" <mfrohgast (AT) yahoo (DOT) de> wrote

Quote:
Hello,

just one question about the AdventureWorksDB sample database: Why are
there "artificial" primary keys such as TimeKey and AccountKey which start
from 1? Is there any reason not to use the date, for example 1/1/2004, or
the specific account number, as primary key?
TimeKey FullDateAlternateKey DayNumberOfWeek
915 1/1/2004 5
916 1/2/2004 6
917 1/3/2004 7
918 1/4/2004 1


Thanks.

Mark




Reply With Quote
  #3  
Old   
Mark
 
Posts: n/a

Default Re: Primary Key for Dimension Tables in AdventureWorksDW - 12-26-2006 , 10:50 PM



Thank you!

Mark

"Jeje" <willgart (AT) hotmail (DOT) com> wrote

Quote:
they use identify columns.
So the counter starts at 1.

in a standard DW system generally we use an integer instead of a date/time
for the time dimension for performance reason.
for other dimensions, using a surrogatekey give some advantages. Specially
if your source system use characters has a key. Also, surrogatekeys allow
you to load data from multiple sources where you'll have the same account
number, using surrogate keys you can create 2 keys (1 by source).
again, using integer improve performance and storage.

when you have only 1 source where the codes are integers and you don't
have slow changing dimensions, then you can use the source key instead of
a surrogate key.

remember the adv. works is a sample based on standard best practices for a
DW structure.

"Mark" <mfrohgast (AT) yahoo (DOT) de> wrote in message
news:OwBPMYTKHHA.1280 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
Hello,

just one question about the AdventureWorksDB sample database: Why are
there "artificial" primary keys such as TimeKey and AccountKey which
start from 1? Is there any reason not to use the date, for example
1/1/2004, or the specific account number, as primary key?
TimeKey FullDateAlternateKey DayNumberOfWeek
915 1/1/2004 5
916 1/2/2004 6
917 1/3/2004 7
918 1/4/2004 1


Thanks.

Mark






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.