TE
TechEcho
AccueilTop 24hRécentsMeilleursQuestionsPrésentationsEmplois
GitHubTwitter
Accueil

TechEcho

Une plateforme d'actualités technologiques construite avec Next.js, fournissant des nouvelles et discussions technologiques mondiales.

GitHubTwitter

Accueil

AccueilRécentsMeilleursQuestionsPrésentationsEmplois

Ressources

HackerNews APIHackerNews OriginalNext.js

© 2025 TechEcho. Tous droits réservés.

Implementing State Machines in PostgreSQL (2017)

23 pointspar todsacerdotiil y a environ 9 heures

2 comments

michelppil y a environ 8 heures
While this is a good approach to implements state machines, the transition function is hardwired to one transition graph. Another approach is to generalize the state and transition graph into a table, and group those transitions by a machine id, as shown here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;michelp&#x2F;pgfsm">https:&#x2F;&#x2F;github.com&#x2F;michelp&#x2F;pgfsm</a><p>Now many machines (sub-graphs of state transitions) can be defined in general, and the transition checking function checks the validity of the next state based on the table, instead of static rules in a function.
smitty1eil y a environ 2 heures
TFA says he&#x27;s using this to<p>&gt; implement a realtime analytics dashboard for an application with over a billion event rows.<p>I&#x27;m interested in seeing how well this could be attained in SQLite with window functions[1] since SQLite doesn&#x27;t seem to support a CREATE AGGREGATE.<p>There would also need to be some python[2] to provide the PL&#x2F;SQL logic shown.<p>[1] <a href="https:&#x2F;&#x2F;sqlite.org&#x2F;windowfunctions.html" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;windowfunctions.html</a><p>[2] <a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;sqlite3.html#sqlite3.Connection.create_function" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;sqlite3.html#sqlite3.Conne...</a>