How to Listen to Database Changes Using Postgres Triggers in Elixir

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • walex

    Postgres change events (CDC) in Elixir

  • If you want to stay in the Elixir world, I’ve created WalEx which listens to the Postgres WAL similar to Debezium and doesn’t suffer from scale issues of the trigger notify approach:

    https://github.com/cpursley/walex

  • supavisor

    A cloud-native, multi-tenant Postgres connection pooler.

  • Phoenix.PubSub is basically a noop service. It really just works. You should try it!

    If discovering nodes is difficult in your env, try using a listen/notify libcluster strategy:

    https://github.com/supabase/supavisor/blob/main/lib/cluster/...

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • realtime

    Broadcast, Presence, and Postgres Changes via WebSockets

  • I believe #2 was the main driver for the supabase team to build their real-time component: https://github.com/supabase/realtime

    Background/announcement: https://supabase.com/blog/supabase-realtime-multiplayer-gene...

  • debezium

    Change data capture for a variety of databases. Please log issues at https://issues.redhat.com/browse/DBZ.

  • pgcat

    PostgreSQL pooler with sharding, load balancing and failover support.

  • For #1 I've been keeping a keen eye on pgcat [1], in particular the https://github.com/postgresml/pgcat/issues/303 which

  • cainophile

  • If you want to listen to database changes in Elixir you can also get really good stuff done by using Cainophile (https://github.com/cainophile/cainophile). Same mechanism. I don't know the details of Debezium so I can't say if you are leaving fantastic things on the table. But I've had good fun with Cainophile. For example I've used it in my videos on Electric SQL to react to changes in a Postgres database. It matches nicely with realtime-ish UI via LiveView. So meshes really good with the current Elixir stack.

  • postgrex_pubsub

    A helper to turn postgres mutations into a pubsub channel

  • https://github.com/bnchrch/postgrex_pubsub

    And But it you want something even better I recommend WalEx

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • mssql-changefeed

  • We made mssql-changefeed for this purpose:

    https://github.com/vippsas/mssql-changefeed

    V1 requires to run a sweeper procedure in the background, but an upcoming v2 version does without the sweep loop. Unfortunately too fresh for readme to be updated, but relevant lines in tests to show it off:

    https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/go/...

    https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/go/...

    https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/go/...

    Library itself:

    https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/mig...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts