A Slowly Changing Dimension (SCD) is a dimension that stores and manages both current and historical data over time in a Data Warehouse.

It is considered and implemented as one of the most critical ETL tasks in tracking the history of dimension records.

How do you track slowly changing dimensions in a database

Take a customer dimension in a retail database.

Consider a retail company that tracks customer information, including attributes such as name, address, and membership status. Over time, customers may change their addresses or upgrade their membership levels.

Implementation of SCD

  • The original record for John Doe is retained with an end date to indicate that it is no longer current.
  • A new record is created for the updated information, allowing the company to maintain a history of changes over time.
  • This approach allows analysts to query the data and understand customer behavior and trends over time, which is essential for reporting and decision-making.
  1. Current Data: The current state of the customer dimension might look like this:
Customer IDNameAddressMembership Status
1John Doe123 Elm St, City AGold
2Jane Smith456 Oak St, City BSilver
  1. Change Occurs: If John Doe moves to a new address and upgrades his membership to Platinum, the company needs to track this change.

  2. Historical Data: Using the SCD approach, the dimension table might be updated as follows:

Customer IDNameAddressMembership StatusEffective DateEnd Date
1John Doe123 Elm St, City AGold2022-01-012023-10-01
1John Doe789 Pine St, City APlatinum2023-10-01NULL
2Jane Smith456 Oak St, City BSilver2022-01-01NULL