Implementing SCDs As Temporal Tables
Under no circumstances should you use temporal tables in your data warehouse.
Microsoft introduced the concept of a temporal table with Sequel server 2016. I resisted implementing temporal tables in the data warehouse for a very long time for two reasons.
I thought temporal tables were for OLAP systems. I did not see an EDW use case.
I did not like the idea of giving up control of marking and retiring records to the system. I do not even like to write triggers so you could imagine how I felt about automagically populated effective to and from dates.
However, I was finally forced to take a look at temporal tables for managing SCDs. Then I was forced to work with the bloody things and I’m here to tell you, temporal tables are the devil’s work. They should not be implemented in an enterprise grade EDW.
At first blush, these things seem like mana from heaven.
Implementing your SCDs as temporal tables DRASTICALLY reduces the amount of code you have to write to process an SCD.
The primary key on the dimension doesn’t change.
These things are the serpent telling you to eat the forbidden fruit.
The truth is, from an operational perspective, these things are problematic in the extreme.
Microsoft itself list off a big ole pile of limitations.
Temporal tables use a special SQL syntax that isn’t intuitive.
Temporal queries don’t work over Linked Servers.
You can’t run TRUNCATE on temporal tables.
You can’t just drop a temporal table.
You can’t design temporal tables IN SSMS.
Loading historical data manually is task intensive.
Take a pass on temporal tables. Zero ten do not recommend.
Last updated