From e345259e3c2e515f3a859eeb168a67a1a09141e3 Mon Sep 17 00:00:00 2001 From: DmitriiAn Date: Thu, 7 May 2026 15:50:08 +0200 Subject: [PATCH] use ALTER ROLE for wal_sender_timeout instead of ALTER SYSTEM --- pgcopydb-helpers/README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pgcopydb-helpers/README.md b/pgcopydb-helpers/README.md index ff51cac..3542f91 100644 --- a/pgcopydb-helpers/README.md +++ b/pgcopydb-helpers/README.md @@ -22,6 +22,9 @@ GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO migration_user; -- For future tables created before migration starts ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO migration_user; + +-- Prevent idle replication connection from being dropped during long COPY phases +ALTER ROLE migration_user SET wal_sender_timeout = 0; ``` Repeat the `GRANT USAGE`, `GRANT SELECT`, and `ALTER DEFAULT PRIVILEGES` statements for each schema being migrated. @@ -75,13 +78,6 @@ You can verify logical replication is enabled on any platform with: SHOW wal_level; -- should return 'logical' ``` -**`wal_sender_timeout`:** Set this to `0` on the source to prevent the replication slot from being dropped during long COPY phases. The initial data copy can take hours on large databases, and the default timeout (60s) may cause PostgreSQL to drop the idle replication connection before CDC streaming begins. - -```sql -ALTER SYSTEM SET wal_sender_timeout = 0; -SELECT pg_reload_conf(); -``` - ### Target Database (PlanetScale) - The target database must be created before starting the migration — pgcopydb does not create databases.