# đź”§ Field Note 01: The Overwrite Fallacy
### Why your database is sabotaging your firm's defense
**By Lund Consulting | Der Maschinenraum**
In the **Maschinenraum** (Engine Room) of a regulated firm—whether insurance, banking, or asset management—there is a specific mistake that gets a junior developer hauled into the CFO's office.
This mistake is not a syntax error.
It is an architectural failure that risks the entire ledger:
The database confuses **WHEN IT HAPPENED** with **WHEN WE LEARNED ABOUT IT**.
We call this **the Overwrite Fallacy**: if the system does not distinguish between those two events, what looks like an innocent *data insertion* becomes a deadly *overwrite* of the truth.
---
## 1. The "Intuitive" Mistake
To see why, let's look at a standard **Quarterly Close** scenario.
1. **March 31 (Q1 End):** A service (e.g. insurance, management etc.) is delivered. The Quarter ends.
2. **April 4:** The CFO runs the **Q1 Revenue Report**.
- The invoice (insurance premium, management fee or else) for that service hasn't arrived yet.
- **Result:** Revenue is **$1.0M**.
- _Action:_ The CFO signs the report and sends it to the Board/Regulator.
3. **April 5:** The late invoice arrives ($50k).
- _**The "Intuitive" Mistake**:_ The system was intuitively design to have the update via an insert of the invoice with `service_date = '2024-03-31'`.
---
## 2. The Moment of Disaster
4. **June 1 (The Audit):** An auditor asks to "Reproduce the Q1 Report". The junior queries the database, filtering for `service_date <= '2024-03-31'.
- **The Database says:** Revenue was **$1.05M**.
- **The signed Q1 report says:** Revenue was **$1.0M**.
**You are cooked. 🍳**
You cannot explain the discrepancy.
The database is telling the truth about when the service happened (**WHEN IT HAPPENED**).
But it has "forgotten" that we didn't know about this service on April 4th (**WHEN WE LEARNED ABOUT IT**)
You have *overwritten* **What You Knew At Each Point in Time**, leaving yourself defenseless.
---
## 3. Visualizing the Logic Gap
The error stems from treating Time as a single dimension.
In reality, regulated data always has **Two Clocks** ticking simultaneously.
1. **Reality** (also known as "Valid Time"): When did this event actually occur? (Mar 31).
2. **Database** ("Transaction Time"): When did the database know about the event? (Apr 5).
```mermaid
gantt
title The Gap Between Reality and Database
dateFormat YYYY-MM-DD
axisFormat %b %d
section Reality
Service Delivered (Mar 31) :crit, active, 2024-03-31, 1d
section Database
System Ignorance :done, 2024-03-31, 2024-04-05
Record Created (Apr 5) :active, 2024-04-05, 1d
```
If you insert an invoice with **a single time dimension** `service_date`, you are flattening these two dimensions into one.
It becomes impossible to answer the auditor's question: _"What did we know on April 4th?"_
---
## 4. The Engineering Requirement
To survive any audit, the engine must answer two questions simultaneously:
1. **The Functional Question:** "Does this invoice belong to Q1?"
- _Answer:_ **Yes.** (So we pay it correctly).
2. **The Audit Question:** "Did we include it in the Q1 report generated on April 4th?"
- _Answer:_ **No.** (So we don't go to jail for falsifying reports).
This question does not only pertain to invoices. It is also crucial for banking details of investors or clients, insurance premiums or commissions, signed documents, reported cashflows, acquisitions, or holding structures.
### The Fix: Bitemporality
To solve this, we must introduce **two clocks** into the core architecture of our database.
This allows us to "time travel" and to view the state of the ledger at any point in history.
In the next episodes, we will
- break down the technical implementation of Bitemporality in SQL
- explain why this approach is preferred over "time travel" features in modern warehouses (like Snowflake or SQL Server)
---
### _Der Maschinenraum_
Field notes from our disciplined implementation projects.
For any questions, comments or inquiries, please comment on our LinkedIn Post or reach out to us directly:
[email protected]