Logical Replication Best Practices
Watch for DDL limitations; schema changes are hard. These rules keep logical replication stable across upgrades and schema evolution.
Search across all documentation pages
Watch for DDL limitations; schema changes are hard. These rules keep logical replication stable across upgrades and schema evolution.
REPLICA IDENTITY. Updates and deletes replicate reliably.REPLICA IDENTITY DEFAULT (PK) over FULL when possible. FULL increases WAL volume.CREATE SUBSCRIPTION. Tables, types, and indexes must exist on subscriber.ALTER TABLE automatically.FOR ALL TABLES in production. Avoid accidental replication of sensitive tables.ALTER SUBSCRIPTION ... REFRESH PUBLICATION after ADD TABLE. New tables do not copy otherwise.DROP SUBSCRIPTION to clean publisher slots. Manual slot drops if connection blocked.confirmed_flush_lsn lag bytes. Same disk risk as physical slots.enabled = false) during subscriber maintenance. Resume with lag check.max_replication_slots and max_wal_senders for logical + physical consumers. Combined load on primary.CONNECTION string (sslmode=verify-full). Encrypt cross-network replication.CREATE PUBLICATION. Publications expose change streams.Schema drift and DDL coordination. Plan migrations on publisher and subscriber together.
Dev/staging clusters or single-schema apps with strict create-table governance.
PostgreSQL 18 supports truncate in publications. Ensure subscriber expects empty table events.
Apply stops. Fix data, skip LSN (advanced), or rebuild subscription from fresh copy.
Replicate base table; verify index definitions on subscriber with pgvector 0.8+ after cutover.
Stack versions: This page was written for PostgreSQL 18.4 (stable 18, maintenance 17), pgvector 0.8+, PgBouncer 1.x, Patroni 3.x, and PostGIS 3.5+.
Reviewed by Chris St. John·Last updated Jul 18, 2026