Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Interesting question @Argnist!</p> <p>So to create some common language for my example, you want a </p> <ul> <li>DimPerson (PK=kcPerson, suggorate key for unique Persons=kPerson, type 2 dim)</li> <li>DimDocument (PK=kcDocument, suggorate key for unique Documents=kDocument, type 2 dim)</li> <li>DimAddress (PK=kcAddress, suggorate key for unique Addresses=kAddress, type 2 dim)</li> </ul> <p>A colleague has written a short blog on the usage of two surrogate keys to explain the above dims '<a href="http://www.consolidata.co.uk/SQL-blog/2008/07/using-2-surrogate-keys-on-dime.html" rel="nofollow">Using Two Surrogate Keys on Dimensions</a>'.</p> <p>I would always add DimDate with PK in the form yyyymmdd to any data warehouse with extra attribute columns.</p> <p>Then you would have your fact table as </p> <ul> <li>FactHistory (FKs=kcPerson, kPerson, kcDocument, kDocument, kcPerson, kPerson, kDate) plus any aditional measures.</li> </ul> <p>Then joining on the "kc"s you can show the current Person/Document/Address dimension information. If you joined on the "k"s you can show the historic Person/Document/Address dimension information.</p> <p>The downside of this is that this fact table needs one row for each person/document/address/date combination. But it really is a very narrow table, since the table just has a number of foreign keys.</p> <p>The advantage of this is it is very easy to query for the sorts of questions you were asking.</p> <p>Alternatively, you could have your fact table as </p> <ul> <li>FactHistory (FKs=kcPerson, kPerson, kcDocument, kDocument, kcPerson, kPerson, kDateFrom, kDateTo) plus any aditional measures.</li> </ul> <p>This is obviously much more compact, but the querying becomes more complex. You could also put a view over the Fact table to make it easier to query!</p> <p>The choice of solution depends on the frequency of change of the data. I suspect that it will not be changing that quickly, so teh alternate design of the fact table may be better.</p> <p>Hope that helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload