- Go to the Logs Explorer in the Supabase Dashboard
- Select Templates / Errors
- Look for errors related to your replication
A common issue that comes up is a lack of available replication slots or available worker processes. By default, Supabase projects are set up with a max of 4 worker processes (max_worker_processes
) and 5 replication slots (max_replication_slots
).
show max_worker_processes;
show max_replication_slots;
alter system set max_worker_processes to '8';
alter system set max_replication_slots to '8';
These new settings will not take effect until you restart your database. You can do this with the Restart Server button in the Supabase Dashboard.
On the replica:
ALTER SUBSCRIPTION my_subscription REFRESH PUBLICATION;
select * from pg_replication_slots;
To drop a subscription, disable it, drop the slot, then drop the subscription.
ALTER SUBSCRIPTION my_subscription REFRESH PUBLICATION;
ALTER SUBSCRIPTION my_subscription DISABLE;
ALTER SUBSCRIPTION my_subscription SET (slot_name=NONE);
DROP SUBSCRIPTION my_subscription;
When re-recreating the subscription on the replica, you may receive an error saying that you have a duplicate slot. In that case, drop the slot on the primary server:
select * from pg_replication_slots;
select pg_drop_replication_slot('my_subscription');