DimProduct |
|
DimSubcategory |
|
Dimcategory |
productpk |
|
subcategorypk |
|
categorypk |
sku |
|
subcategoryName |
|
categoryName |
productName |
|
categorypk |
|
|
subcategorypk |
|
|
|
|
Snow flake schema has one weakness,
Take the product dimension sample, its has subcategory attribute. If we want to track the subcategory's change,
Set the subcategory as a type2 dimension. Now the design can not support.
But how can we fix this issue?
set the product dimension as type2, and change the subcategory and category information all in this product table.
Then the snow flake schema turn into a star schema.
This sample is special, because you can see that the subcategory and category has just one attribute in tables,
If one table 's sub table has more attributes, it is not useful to add all attributes in the parent table.
So what we can do for this case if we want to keep track the sub tables changes?
In this case , we should add the unique key columns and sub table primary key in the parent table.
If your dimension and fact tables are all type2, the customer want to track all the dimension tables' change,
In you fact table, you capture all the relationships for the dimension tables.
If you just populate dimension tables' primary key in the fact table, how could you keep the records consecutive?
You need join back the dimension table and judge whether it change or not?
Or you should add one dimension table's unique key columns in the fact table?
Tell me if you have better solution for this.