5 ms·
Unrelated to the post: Is there realtime features with postgres? It seem like a kludge to have to add redis, mqtt, or kafka to our application to get things a
by alfor 3y ago
Unrelated to the post:
Is there realtime features with postgres?
It seem like a kludge to have to add redis, mqtt, or kafka to our application to get things as they change.
- defaultcompany 3y agoThere is NOTIFY [1] that might do what you are thinking of. [1] https://www.postgresql.org/docs/current/sql-notify.html https://www.postgresql.org/docs/current/sql-notify.html
- devbug 3y agoYou can LISTEN/NOTIFY. Or you can use logical replication and a custom subscriber.[1] Supabase uses the latter.[2] [1]: https://www.postgresql.org/docs/current/logical-replication.html https://www.postgresql.org/docs/current/logical-replication.... [2]: https://github.com/supabase/realtime https://github.com/supabase/realtime
- mritchie712 3y agowe use this feature in Supabase, works great.
- dventimi 3y agoSupabase has arguably a better alternative, which uses logical replication and can be used outside of Supabase. https://github.com/supabase/realtime https://github.com/supabase/realtime
- jacobprall 3y agoSupabase realtime (especially if you want a managed backend) or other streaming CDC setups (like Decodable, which is Flink/Debezium under the hood) are also great choices for logical replication. Streaming tech will continue to get more cost-effective and simpler to implement in the coming year(s). I should note: I haven't used Decodable in production yet, I'm just a fan of Flink :)
- cryptonector 3y agoOne caveat about LISTEN/NOTIFY is that channels are not first-class objects, so there's no authorization associated with them, thus anyone who can login can also NOTIFY any payload to any channel.
- cpursley 3y agoYes, WalEx. Recently added the concepts of Destinations - where you can just configure it to send database change events to an Elixir module, webhook or EventRelay (the later two don't require Elixir know-how). https://github.com/cpursley/walex?tab=readme-ov-file#destinations https://github.com/cpursley/walex?tab=readme-ov-file#destina...
- jacobprall 3y agoYoure right, real-time is generally achieved by streaming CDC data with logical replication via a connector server to Kafka (Debezium does this) or a different queue to be picked up by consumers downstream. Supabase does a great job of abstracting that part away with their real-time feature set