ENES

Slowly changing dimension

The rules a data warehouse uses when descriptive data, like a customer's city, changes.

A customer dimension table where a move from Córdoba to Rosario adds a new row; the old row gets an end date and the new one is marked current

In a star schema, dimension tables describe the who, what and where of each event: the customer, the product, the store. Most of that barely changes, but it does change now and then. A customer moves, a product switches category, a store gets a new manager. A slowly changing dimension, or SCD, is a dimension that has to deal with these occasional changes, and the term usually refers to the techniques for handling them.

The choice matters because it changes history. Say Ana moved from Córdoba to Rosario in March. With Type 1 you simply overwrite the city; it is easy, but now all her purchases from last year show up as Rosario sales. With Type 2 you keep the old row, close it with an end date, and add a new row for Rosario with its own surrogate key, valid from March and marked as current. Old sales stay attached to Córdoba, new ones to Rosario. Type 3 adds a "previous city" column, which keeps only one step of history.

Type 2 is the most common when history matters, and it is why many dimension tables carry columns like valid_from, valid_to and is_current. The type numbers come from Ralph Kimball's dimensional modeling, and teams often mix them in one table: overwrite a typo fix, keep history for the address. Modern tools such as dbt snapshots and Microsoft Fabric pipelines can build Type 2 tables automatically.

Keep in mind

Go deeper

Related terms

More in Data