All Articles

Event Sourcing in Postgres

Big companies benefit from products like RabbitMQ, Kafka, or Elastic Search, and have the matching economy to pay for the required resources, mostly clusters of virtual machines.

All the other companies would benefit from the same patterns, but donโ€™t have enough scale to make it efficient.

๐Ÿ‘‰ Money is always a scarce resource ๐Ÿ‘ˆ

Running a cluster of 3 servers just to store a few million messages in a RabbitMQ queue or Kafka topic is simply too expensive.

A relational database such PostgreSQL it is still among the cheapest options to store large amount of data in a persistent and reliable way.

In this series of articles, weโ€™re going to discover a data model that let us store and consume events in a reliable way, offering the possibility for concurrent producers/consumers to work together without race-condition each other.

๐Ÿ‘‰ The entire source code, complete with tests and performance analysis is available at: https://github.com/marcopeg/postgres-event-sourcing.