Friday, July 12, 2013

Slow Changing Dimensions

For example, a person's name can be changed due to marriage status changed, a person's address can change due to moving to another place.

For the changed dimensions, there are usually two ways to handle the change.

Method one is to overwrite the values in existing dimension table, for instance, change the person's name directly. The change history is not maintained and since the preexisting facts have a new context, it sometimes may lead to confusion. So this method applies to minor attributes changes. Benefit of this approach is it's easy to group existing facts and new facts into same dimension.

Method two is to create a new record in dimension table. For instance, create a new record with new surrogate key for person's new address. This approach retains all the change history, the pre-existing facts can be viewed as they were (Historic fact context is preserved). But confusion also raise up because duplicated dimensions appear in the dimension table, very often, extra efforts need to be done to combine the slowly changing dimensions back to one dimension in the reports (a fact table for the changes to resolve this problem).