SCD - Slowly changing dimensions

Slowly changing dimensions (SCD) determine how the historical changes in the dimension tables are handled. Implementing the SCD mechanism enables users to know to which category an item belonged to in any given date.

Types of Slowly Changing Dimensions in the Data Warehouse architectures:



In order to manage Slowly Changing Dimensions properly and easily it is highly recommended to use Surrogate Keys in the Data Warehouse tables.
A Surrogate Key is a technical key added to a fact table or a dimension table which is used instead of a business key (like product ID or customer ID).
Surrogate keys are always numeric and unique on a table level which makes it easy to distinguish and track values changed over time.


Technically key hash and data hash are used to manage and track changes to dimension records efficiently: Key hash is a hash value generated from the primary key of a record. It helps in quickly locating records and ensuring that each key is unique, often used in indexing and partitioning strategies.
Data hash is a hash value computed from the entire set of data in a record. It is used to detect changes or verify data integrity by comparing hash values to identify if any data has been altered.



In practice, in big production Data Warehouse environments, mostly the Slowly Changing Dimensions Type 1, Type 2 and Type 3 are considered and used. It is a common practice to apply different SCD models to different dimension tables (or even columns in the same table) depending on the business reporting needs of a given type of data.

As a follow up you may want to have a look at the following example to see a sample implementation of SCD in Datastage:
Slowly Changing Dimensions - Datastage job designs and examples