Get the latest tech news
Implementing State Machines in PostgreSQL (2017)
Finite-state machine (FSM) is a wonderful model of computation that has many practical applications. One of my favorites is turning business logic into simple FSMs.
Additionally the process of naming the involved states and events automatically creates a precise language that can be adopted by all stakeholders. The first thing we need is a good way to take a list of events and call our transition function on them recursively to determine the resulting state. But if you want some reassurance: I’ve had great success in applying this approach in combination with eager materialization to implement a realtime analytics dashboard for an application with over a billion event rows.
Or read this on Hacker News