Are you considering Event Sourcing? Think again. by Eduardo Bellani

Are you considering doing event sourcing? Maybe you have read that it is necessary for your project or that you will have great benefits in doing so.

If so, I ask you to think about an alternative. Maybe you already have something of equal capacity in the tooling that you use and could extract all the benefits for a fraction of the cost. What is that something? Your old SQL RDBMS (MySQL, PostgreSQL, SQL Server, Oracle, etc).

Here is the kicker: Temporal tables! Most SQL DBMSes already implement such feature(Jungwirth 2019), and they basically allow you to reap all the benefits of ES while still keeping to your CRUD style of programming(Esposito 2017). Think continuation passing style, but with an async/await syntax that allows you think linearly.

To demonstrate the point, here is a table with the claimed benefits from each approach, from the vendors themselves(slightly reworded for space eficiency)(Team 2024; Microsoft 2024):

Temporal Tables Event Sourcing Meaning
Auditing Auditing An immutable audit trail
Recovering from application errors Testing & RCA Improving debugging by having ‘what if’ scenarios
Calculating trends Analytics Capabilities Temporal queries to see your past beliefs
Reconstructing data Zero data loss All state is preserved
Figure 1: Mock execution of Jesus Christ by the Death Brigade, communist revolutionaries led by Pascual Fresquet. Spain 1936.

Figure 1: Mock execution of Jesus Christ by the Death Brigade, communist revolutionaries led by Pascual Fresquet. Spain 1936.

References

Esposito, Dino. 2017. “Soft Updates with Temporal Tables.” MSDN Magazine. https://learn.microsoft.com/en-us/archive/msdn-magazine/2017/march/cutting-edge-soft-updates-with-temporal-tables.
Jungwirth, Paul A. 2019. “Survey of Sql:2011 Temporal Features.” Illuminated Computing. https://illuminatedcomputing.com/posts/2019/08/sql2011-survey/.
Microsoft. 2024. “Temporal Tables.” Microsoft documentation. https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables.
Team, Event Store. 2024. “Benefits of Event Sourcing.” Event Store Blog. https://www.eventstore.com/blog/benefits-of-event-sourcing.

Links to this note