Choosing Your Strategy

The choice is made per column, and one dimension usually mixes rules. On dim_host, payout_email can be Type 1, tier Type 2 and region Type 3, all in the same table. A dimension is called Type 2 when at least one of its columns creates new rows.

PropertyType 1Type 2Type 3
On a changeReplace the valueClose the row, add a rowShift the value into a previous column
One row meansThe entity as known todayOne version, valid for a windowThe entity today plus one earlier value
Rows per entity11 per version1
History keptNoneEvery version, with datesThe latest change only
Past facts showToday's valueThe value at event timeEither label, across all facts
Breaks whenA closed period must stay fixedThe attribute changes dailyA second change arrives

3 questions for each column

Ask them in this order

The second question separates as-was reporting from as-is reporting. As-was shows each fact with the attribute value from its own date, and finance, billing and compensation nearly always require it. As-is shows all facts under today's values, which suits questions about the entities themselves, such as how today's Superhosts grew over time.

Mixing rules on one table

Mixing has one mechanical consequence. When a Type 1 column changes on a table that also has Type 2 columns, the update must reach every version of that entity. If Marta's host_name is corrected, rows 101 and 104 both receive the fix and no new version is created. A name that differed between versions would split her bookings in any report grouped by name.

When you are unsure

The 2 main rules differ in what can be undone later. A Type 2 dimension can always serve as-is questions through its current rows. A Type 1 dimension can never serve as-was questions, because the old values were discarded and no backfill can invent them. For a column that reports group by, with an uncertain future, Type 2 is the reversible choice. Its extra rows cost storage, and a missing history cannot be bought back at any price.

One case argues against Type 2: an attribute that changes very often. A host's average review score moves after every review. Tracking it as Type 2 would add a dimension row per review, and the dimension would grow like a fact table. A value that changes with events is a measurement, and it belongs in a fact table, such as a periodic snapshot of each host's score.

Write the chosen rule beside each column in the table's documentation. The next person to build a report will read it to learn whether a number can change after it has been published.

About this lesson

This section is part of the Change Tracking lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.