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.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of PostgreSQL

PostgreSQL

Photo of state machines

state machines

Related news:

News photo

Memory Size Matters to PostgreSQL

News photo

PostgreSQL Full-Text Search: Fast When Done Right (Debunking the Slow Myth)

News photo

PostgreSQL Merges Initial Support For NUMA Awareness