Realtime: Broadcast from Database
Supabase Realtime's Broadcast from Database sends database change events to clients through Postgres triggers that write to a `realtime.messages` table. Realtime reads that table via a replication slot on its WAL publication and broadcasts each new row to the target channel immediately. Compared with polling-based Postgres Changes it needs more setup (RLS policies, a trigger function using `realtime.broadcast_changes` or `realtime.send`, and private channels on the client). In return it can target specific operations, send only chosen columns, route messages to channels with SQL, and scale to tens of thousands of concurrent subscribers. `realtime.send` catches exceptions and reports errors via `pg_notify`, so a failed send does not break the trigger.
Related posts
- Realtime: Multiplayer Edition
Supabase mediumAdeptSupabase Realtime's Broadcast and Presence features are now generally available, with every feature organized around Channels that also carry Postgres change events. Broadcast is ephemeral pub/sub that bypasses the database, which suits things like cursor positions. Presence syncs shared state to new joiners and drops users automatically when they disconnect. Realtime originally chose logical replication over LISTEN/NOTIFY because NOTIFY payloads are capped at 8,000 bytes. It now runs as a globally distributed Elixir cluster on Fly, using Phoenix PubSub for Broadcast and the delta-CRDT-based Phoenix Tracker for Presence, and supabase-js examples show both features in use.
- Realtime or Pipelines? How to choose the right tool
Supabase mediumAdeptSupabase Realtime and Supabase Pipelines both read Postgres changes via logical replication but serve different jobs. Realtime pushes changes to client apps over WebSocket with best-effort delivery, temporary replication slots, and a per-subscriber RLS check for every change, typically under 100ms. Pipelines is managed CDC to analytical destinations like BigQuery, with persistent slots, at-least-once delivery, batching, and resume from retained WAL. The guidance: never use Realtime's Postgres Changes to maintain a durable copy of data in another system, because disconnects and restarts silently drop changes. Use Pipelines for that and Realtime for live user-facing updates, often both together.
- Realtime Postgres RLS now available on Supabase
Supabase mediumAdeptSupabase Realtime now enforces PostgreSQL Row Level Security on change broadcasts. Previously every database change went to every client. A new in-database function, WALRUS, takes each logical replication record, finds active subscribers from a subscription table, assumes each subscriber's identity and checks visibility with a primary-key lookup. Prepared statements remove query planning cost, which is often 2-3x execution time for simple queries, and colocating the check in Postgres avoids network round trips. Per-record processing grows from about 11 ms with 1 subscriber to about 304 ms with 10,000. Recommendations: skip RLS on public tables, keep policies index-backed and join-free, and use small fixed-size primary keys.
- Supabase Realtime: Broadcast and Presence Authorization
Supabase mediumAdeptSupabase Realtime now supports authorization for Broadcast and Presence channels using Postgres Row Level Security policies on a managed `realtime.messages` table, where SELECT policies govern receiving and INSERT policies govern sending. Clients opt in with a `private: true` channel config, and policies can reference the channel name via `realtime.topic()` and the extension column. On subscription, the server loads JWT claims into a Postgres transaction with `set_config`, runs rolled-back SELECT/INSERT probes against the table, and caches the resulting per-socket policy map in memory. This adds latency only at connect time, and policies are re-checked on reconnect or token refresh, so token expiry controls how quickly policy changes take effect.
- Neon now has realtime
Neon mediumAdept
Neon Realtime, now in free public beta, turns any read-only deterministic SQL query (joins, aggregates, window functions, subqueries) into a live query whose result stays updated as data changes, running inside Postgres rather than as a separate realtime service. A TypeScript SDK lets backends define queries via raw SQL, Drizzle or Kysely and "seal" them so browsers or agents can subscribe safely, with React's useLiveQuery, optimistic writes confirmed via awaitTxId, SSR and TanStack DB support. Clients connect to Neon's ingress layer so subscriptions don't block scale-to-zero, incremental maintenance runs on a replica without consuming connections, and Realtime is enabled per branch. Beta limits include no row-level security, no published benchmarks, a changing protocol and four regions.