Handling Changes in Dimension Attributes
Dimension attributes change over time. SCD techniques manage these changes while maintaining historical accuracy.
Type 1: Overwrite (No History)
Method: Simply update the dimension record, losing historical data.
Use Case: Corrections, insignificant changes (e.g., fixing typos)
| customer_key | name | city |
| 101 | John Smith | Mumbai → Delhi |
Impact: Historical reports show new value for all time periods
Type 2: Add New Row (Full History)
Method: Create a new dimension record with new surrogate key, preserve old record.
Use Case: Important changes requiring historical tracking
| customer_key | name | city | start_date | end_date | current_flag |
| 101 | John Smith | Mumbai | 2020-01-01 | 2024-06-30 | N |
| 102 | John Smith | Delhi | 2024-07-01 | 9999-12-31 | Y |
Impact: Complete history maintained, accurate reporting for all periods
Type 3: Add New Column (Limited History)
Method: Add columns to track previous value (e.g., current_city, previous_city).
Use Case: Track only the most recent change