Skip to the page
Tecyfy

What are slowly changing dimensions (SCD type 1, 2 and 3)?

The ways a warehouse handles a change to a descriptive record, such as a customer's address: type 1 overwrites it, type 2 adds a new dated version, and type 3 keeps the previous value in an extra column.

intermediate · Also called SCD, SCD type 1, SCD type 2, History tracking

Slowly changing dimensions are the rules for what a data warehouse does when a descriptive record changes: a customer moves, a product changes category, a sales rep changes region. There are 3 common answers, numbered in the Kimball Group’s dimensional modelling techniques. Type 1 overwrites the old value, type 2 adds a new dated version of the row, and type 3 keeps the previous value in an extra column.

Why a change is a problem

A warehouse keeps 2 kinds of table. Facts record events with amounts, such as orders. Dimensions describe who and what the events were about, such as customers and products, and reports group facts by them: sales by city, by tier, by category. These records change slowly, which is where the name comes from, but they do change. When a customer moves from York to Bristol, what should happen to the orders she placed while she lived in York? The answer decides what every report about cities says.

Try itMove a customer and keep her history
  1. 10 Jan Signs up
  2. 2 Mar Moves to York
  3. 10 Jun Reaches Gold
  4. 20 Sep Moves to Bristol
customers (4 rows for 1 customer)
idcitytier__START_AT__END_AT
7LeedsSilver2026-01-102026-03-02
7YorkSilver2026-03-022026-06-10
7YorkGold2026-06-102026-09-20
7BristolGold2026-09-20null
STORED AS SCD TYPE 2

Her orders, as the report sees them

  • 15 Jan£40.00LeedsRight
  • 2 Apr£25.00YorkRight
  • 1 Jul£60.00YorkRight
  • 5 Oct£30.00BristolRight

Sales by city

  • Leeds£40.00
  • York£85.00
  • Bristol£30.00

Every order is reported under the city that was true the day it was made, because each version of the customer keeps the dates it was current. The price is 4 rows for 1 customer.

The customer, her orders and dates are made up. Type 1, 2 and 3 are Kimball's names. On Databricks a pipeline's AUTO CDC stores a table as type 1 or 2, with __START_AT and __END_AT on each version; type 3 is a column you maintain yourself.

Type 1: overwrite

The customer's row is updated in place: the city becomes Bristol. It is simple and the table stays small, one row per customer. But history is gone. Every past order now reports under Bristol, so last spring's sales for York shrink after the fact, and any summary already built from them is wrong until it is rebuilt. Type 1 suits corrections, such as a misspelt name, and attributes nobody reports history by.

Type 2: add a version

The current row is closed with an end date, and a new row is added for the new values, with a start date and no end. The customer now has 2 rows, and each order joins to the row that was current on the day it was placed. York keeps its spring sales, and Bristol gets only what came after the move. This is the type most teams mean by keeping history.

It costs rows, since a customer who changes often has many versions, and every join has to pick the right version. Kimball's way gives each version its own surrogate key and writes that key on each fact row as it loads. The other common way joins on dates: an order matches the version whose start is on or before the order date and whose end is after it, or null.

You can also choose which columns make a new version. If only the city matters for history, a change of loyalty tier can overwrite the current version instead. The cost appears in the demo above: orders from before the change of tier now report under the new tier.

Type 3: keep the previous value

A second column holds the value before the last change, such as previous_city beside city. Reports can group by either. It handles one change well, such as a sales territory redrawn once, but the second move overwrites the first, so it is used less often than the other 2.

On Databricks

A Lakeflow pipeline does types 1 and 2 with AUTO CDC ... STORED AS SCD TYPE 1 or TYPE 2, from a change data captureChange Data CaptureCopying only the rows that were added, changed or deleted in a source database, read from its change log, instead of copying the whole table again. feed or from snapshots. It orders changes by a SEQUENCE BY column, so an update that arrives late cannot overwrite a newer one, and marks each type 2 version with __START_AT and __END_AT. TRACK HISTORY ON * EXCEPT (tier) leaves a column out of the history. The managed database connectors offer the same history tracking. One warning from the docs: a full refresh replaces the table and its earlier versions with it. Type 3 has no built-in form; it is a MERGE you write.

Why it matters for AI

An assistant asked "how did York do last spring?" queries the same dimension tables a dashboard does. With type 1, it gives a confident answer that is quietly wrong, because York's history was overwritten. Choosing the type is a decision about which questions the warehouseData WarehouseA database built for analysis: cleaned, structured data from many systems, kept in one place and shaped for fast reports and dashboards. can still answer truthfully later.

Sources

Where each fact comes from

  1. 1Type 1: Overwrite
  2. 2Type 2: Add New Row
  3. 3Type 3: Add New Attribute
  4. 4The AUTO CDC APIs: Simplify change data capture with pipelines
  5. 5Enable history tracking (SCD type 2)

Put this demo on your own site

Copy the code into any web page: a lesson, a blog post, a course or your team's wiki. The demo runs in a frame and works just as it does here, so your readers can try it where they read. It is free and needs no account, and nothing a reader does in it is sent anywhere.

The short script at the end lets the frame grow and shrink with the demo. Where a page cannot take scripts, choose a fixed height and the frame scrolls.

<iframe src="https://tecyfy.com/embed/demo/scd" title="Move a customer and keep her history" width="100%" height="1200" style="border:0;display:block" loading="lazy" allow="clipboard-write"></iframe>
<p><a href="https://tecyfy.com/concepts/slowly-changing-dimensions">Move a customer and keep her history</a> by Tecyfy</p>
<script>addEventListener("message",function(e){if(e.origin!=="https://tecyfy.com"||!e.data||e.data.type!=="tecyfy:height")return;var h=Number(e.data.height);if(!(h>0))return;document.querySelectorAll("iframe").forEach(function(f){if(f.contentWindow===e.source)f.style.height=Math.min(h,20000)+"px"})})</script>