Should all dimensions keys in the fact be PKs?
3 posters
Page 1 of 1
Should all dimensions keys in the fact be PKs?
Hi all,
I think I still come from the 3NF mentality that the PK should be the minimal set of attributes that can uniquely identify a row in a table. But as for the fact table in dimensional modeling, this "rule" does not follow right?
My question is, should the primary key of the fact table always be the collection of all[u] FKs of the dim tables? Let us say for example, I have 10 dates in the fact (one is a transaction date which is logically be a PK and the others are 9 are "attribute" dates), should all of these 10 date keys be part of the PK?
Thanks,
Ed
I think I still come from the 3NF mentality that the PK should be the minimal set of attributes that can uniquely identify a row in a table. But as for the fact table in dimensional modeling, this "rule" does not follow right?
My question is, should the primary key of the fact table always be the collection of all[u] FKs of the dim tables? Let us say for example, I have 10 dates in the fact (one is a transaction date which is logically be a PK and the others are 9 are "attribute" dates), should all of these 10 date keys be part of the PK?
Thanks,
Ed
erazon- Posts : 2
Join date : 2012-06-25
Re: Should all dimensions keys in the fact be PKs?
Nope. Use the minimum set of columns to define the PK. In fact I now just put a surrogate key on my fact tables as well. A single numeric PK for all tables in the warehouse is a wonderfully useful thing.
BoxesAndLines- Posts : 1212
Join date : 2009-02-03
Location : USA
Re: Should all dimensions keys in the fact be PKs?
To add to that, there really isn't any particular reason to declare a PK unless you intend to update rows in the fact. If you have a transactional type of fact table where you only insert rows, there isn't a need for a PK.
Also, as far as fact tables go, it is not a good idea to actually enforce PKs even if you need one. It only introduces unnecessary overhead.
Also, as far as fact tables go, it is not a good idea to actually enforce PKs even if you need one. It only introduces unnecessary overhead.
Similar topics
» Composite Dimension Natural Keys - Attribute Used In Multiple Dimensions as well as Fact Tables
» Business keys or Natural keys in the Fact table
» Surrogate keys for degenerate dimensions?
» Is correct store the transactions keys in Dimensions?
» Schema Roadblock: Dimension vs Fact [Dimensions w/FKs to other Dimensions?]
» Business keys or Natural keys in the Fact table
» Surrogate keys for degenerate dimensions?
» Is correct store the transactions keys in Dimensions?
» Schema Roadblock: Dimension vs Fact [Dimensions w/FKs to other Dimensions?]
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum