Skip to content

Setup

1. Ensure database user is a superuser (required to query replication slots):

SELECT usename FROM pg_user WHERE usesuper = true

2. Enable logical decoding in postgres.conf:

wal_level = logical

3. Configure replication slots in postgres.conf:

max_replication_slots = 1

Restart Required

After changing postgres.conf, restart PostgreSQL for changes to take effect.

1. Grant superuser privileges:

GRANT rds_superuser TO <username>

2. Enable logical replication via parameter groups. See AWS documentation.

Prevent Log Growth

On cloud infrastructure, replication slots can cause WAL logs to grow indefinitely. Set a ceiling using max_slot_wal_keep_size:

max_slot_wal_keep_size = 100GB