Supabase Realtime: WAL accumulation during high-churn table replication
0 reputation · 15 Mar 2025, 04:32 UTC
PostgreSQL Logical Replication and Storage
Supabase Realtime leverages the supabase_realtime publication and logical replication slots to stream database changes to clients via WebSockets. This architecture relies on the PostgreSQL Write Ahead Log (WAL) to track and broadcast INSERT, UPDATE, and DELETE events.
Resource Constraints
In environments with high-churn tables—where row modifications occur at a high frequency—there is a risk of significant WAL accumulation. If the replication slot cannot keep pace with the volume of changes or if clients are disconnected, the WAL may grow rapidly, potentially leading to disk pressure on the database instance.
While Row-Level Security (RLS) filters the data delivered to the client, the underlying replication slot must still process the change stream from the WAL.
- How does Supabase manage the trade-off between real-time event delivery and WAL growth on high-velocity tables?
- What are the recommended thresholds for monitoring
pg_replication_slotsto prevent disk exhaustion in production environments?