News for hackers. Stuff that matters.
Re:A Technical Dive into PostgreSQL's replication mechanisms by alfor on Thursday January 11, 2024 @02:00PM (#38957037)
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.

Re:A Technical Dive into PostgreSQL's replication mechanisms by devbug on Thursday January 11, 2024 @02:12PM (#38957252)
You 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....

[2]: https://github.com/supabase/realtime

Re:A Technical Dive into PostgreSQL's replication mechanisms by cryptonector on Thursday January 11, 2024 @03:07PM (#38958215)
One 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.
Re:A Technical Dive into PostgreSQL's replication mechanisms by mritchie712 on Thursday January 11, 2024 @02:25PM (#38957457)
we use this feature in Supabase, works great.
Re:A Technical Dive into PostgreSQL's replication mechanisms by dventimi on Thursday January 11, 2024 @03:49PM (#38958842)
Supabase has arguably a better alternative, which uses logical replication and can be used outside of Supabase.

https://github.com/supabase/realtime

Re:A Technical Dive into PostgreSQL's replication mechanisms by jacobprall on Thursday January 11, 2024 @05:01PM (#38959902)
Supabase 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 :)

Re:A Technical Dive into PostgreSQL's replication mechanisms by defaultcompany on Thursday January 11, 2024 @02:12PM (#38957250)
There is NOTIFY [1] that might do what you are thinking of.

[1] https://www.postgresql.org/docs/current/sql-notify.html

Re:A Technical Dive into PostgreSQL's replication mechanisms by cpursley on Thursday January 11, 2024 @04:16PM (#38959188)
Yes, 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#destina...

Re:A Technical Dive into PostgreSQL's replication mechanisms by jacobprall on Thursday January 11, 2024 @09:41PM (#38962965)
Youre 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