Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is a UID necessary in a fact table

I have a fact table with no UID.


I understand the utility of a uid in a dimension since it may have a corresponding foreign key elsewhere, for example in a fact table.

Is there any reason to add a UID in a fact table that doesn't already have one?

1 Solution

Accepted Solutions
rajeshvaswani77
Specialist III
Specialist III

I do not see any benefit as such by having a UID. Adding autonumber will just ensure the uniqueness for your row. Suppose you want to display rows that are twice, display them twice. QlikView controls would show them as a single rown, however since autonumber gives them a uniqueness, when you make use of this field and display the rows. It will show them twice. Overall it depends on the foreign key granularity. Your ideal UID should be a concatenation of the FK's.

I suppose the community can add more to this.

thanks,

Rajesh Vaswani

View solution in original post

5 Replies
rajeshvaswani77
Specialist III
Specialist III

As per dimensional modelling the combination of various foreign keys would be forming the primary key. There would be no primary key in reality as such. However these combination of foreign keys would determine the granularity of the table. Suppose that you have transactions at a day level then all the sums of transactions have to be recorded at day level, suppose you have them at a hour level then all the sums of transactions have to be recorded at hour level. Basically this depends on your requirement. For more information kindly refere "The Datawarehouse toolkit" by Ralph Kimball.

thanks,

Rajesh Vaswani

Not applicable
Author

It's not quite the the explanation I was expecting.  I have not read Kimball, although I know who he is but I was hoping a direct answer.

Perhaps my formulation was confusing.

The UID I am talking about is the UID of the Fact table proper,  and not any UIDs that it contains that are foreign keys.

Does the Fact Table itself benefit, in any way by having its own proper UID?

I have a working application where there is aFact table that has no proper UID.

What benefit would creating such a UID with an autonumber function, for example,  bring to the application?

rajeshvaswani77
Specialist III
Specialist III

I do not see any benefit as such by having a UID. Adding autonumber will just ensure the uniqueness for your row. Suppose you want to display rows that are twice, display them twice. QlikView controls would show them as a single rown, however since autonumber gives them a uniqueness, when you make use of this field and display the rows. It will show them twice. Overall it depends on the foreign key granularity. Your ideal UID should be a concatenation of the FK's.

I suppose the community can add more to this.

thanks,

Rajesh Vaswani

Not applicable
Author

Rajesh,

Sorry if I seemed abrupt. Yes I suppose that concatenation of foreign keys is equivalent to a UID.

Your second reply was more direct so I understood it betterr; no need to construct a UID autonumber/hash. It is the Correct answer for me.

Perhaps you could take a stab at my first Post about imbricated dimensions. It is really what preoccupies me.

Thanks

Not applicable
Author

Re-reading your replies I found more helpful insights than initially perceived. I may put the UID in the Fact table after all for data validation as you indicated. Thanks again.