Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fact Tables Design 1

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
I'm setting up a star schema dimensional model.
I have a fact field that is text and can be one of a set of values. Is it better to store it as a text value on the fact table or is it better to store it on the fact table as a 1 digit code and link it to a dimension table that holds the text value?.

The first method avoids a join.
The second makes the fact table smaller.

Consider a simple Order Status field that can be 'Active', 'Cancelled', 'Delivered'. I could record the literal text in the fact table of 'Active', 'Cancelled' or 'Delivered'. I could also store the code value of '1', '2' or '3' and link to a dimension table of 'Active', 'Cancelled' and 'Delivered'.

Is there a best practice for going one way or the other?




Dazed and confused
 
Its best practice to use the Integer Foreign Key in this case. There are numerous reasons: to save space in the fact table, to avoid having to update hundreds of millions of rows should you have to change the display name of the attribute, etc, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top