Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 8 min read Opinion mediumAdept

Realtime or Pipelines? How to choose the right tool

Supabase 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.

Assumes: Postgres logical replicationWebSocketschange data capture basics

Related posts

  • Realtime: Broadcast from Database

    Supabase mediumAdept

    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.

  • Introducing Supabase Pipelines

    Supabase mediumAdept

    Supabase Pipelines is a managed change-data-capture service that replicates Postgres tables to analytical destinations in near real time using logical replication, publications and replication slots, with an initial sync followed by batched ongoing changes. BigQuery was the first destination, and an update adds ClickHouse, DuckLake and Snowflake in public alpha. Setup is done in the Dashboard. Constraints include required primary keys for BigQuery, no generated columns, custom types replicated as strings, beta-only schema change support, and no transformations. The underlying ETL engine is open source and written in Rust.

  • Realtime Postgres RLS now available on Supabase

    Supabase mediumAdept

    Supabase 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.

  • Realtime: Multiplayer Edition

    Supabase mediumAdept

    Supabase 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.

  • Postgres Meets Analytics: CDC From Neon to ClickHouse Via PeerDB

    Neon mediumAdept

    Neon serverless Postgres can serve as the transactional system of record while ClickHouse handles real-time analytics, with PeerDB streaming changes between them via Postgres logical replication. Setup involves creating a replication-capable user and a publication in Neon, enabling logical replication (wal_level=logical), creating a destination database and a user with insert/alter grants in ClickHouse, then defining peers and a CDC mirror in PeerDB with an initial snapshot and table selection. PeerDB, now owned by ClickHouse, is slated to power the Postgres CDC connector in ClickPipes.

The quest for software engineering knowledge.

Look:
Layout: