History is queryable
Because event sourcing keeps every change with its timestamp, you can answer temporal queries about the past, such as what was this account balance at the end of last quarter. A system that only stores current state cannot answer this without extra audit machinery.
Two notions of time
- Valid time is when something was true in the real world.
- Transaction time is when the system recorded it.
These can differ when an event is backdated or recorded late, so careful systems track both.
How a point in time query works
- Pick a cutoff time or event version.
- Replay events up to that point only.
- The folded result is the state as it stood then.
Practical notes
- Snapshots near a cutoff speed up point in time replays.
- Auditors and regulators value this because the answer is reconstructed, not stored and possibly tampered with.
- Beware mixing valid time and transaction time in one query, which gives confusing answers.
Key idea
Event histories let you replay up to any cutoff to reconstruct past state, but distinguish valid time from transaction time to keep answers correct.