articles
Data is the same, but answers are different?
Time modeling in data can be tricky.
Imagine the following chronology of events:
- One person joined the company.
- After 2 weeks he informed the company that he was changing his name.
- A month later the company realized that there was a typo in his name in the system.
- After 2 more weeks, the accountant learned that he works only half a day.
How would you design it?
Historization and its limits
We can start with historization, i.e. stamping every row with a valid_from/valid_to date range.
But it cannot help us deal with a tax audit three months later, answering the question of why the heck wrong numbers were sent.
SCD2 tracks changes over time, but doesn’t distinguish when changes actually took effect from when the system learned about them.
Bitemporal modeling

Bitemporal modeling helps by introducing two time dimensions:
processed_at: how the system’s knowledge evolves through time.effective_at: how data producers map events to time.
The ledger
Construct an append-only table, keeping track of whatever we saw so far. Handle late-arriving and out-of-order delivery as it comes.
- Deletion: add a new version of the latest row with an
is_deletedflag. - Past correction: add a new version of the entry with the same
effective_at.
And yes, correcting by deleting something in the past becomes quite an interesting exercise in diplomacy between you and data producers!
This table becomes a ledger keeping all observations. On top of it we derive bitemporal views tailored for point-in-time queries, with two date ranges: effective and processed.
Two kinds of questions
Now we can answer both:
- What do we know today about the state of data last year?
- What did we believe two weeks ago about the state of data last year?
Answers might be different, and that distinction matters a lot.