Subscribe to logical replication changes from another server.
Section: Replication and WAL
Create subscription
sql
sql
CREATE SUBSCRIPTION app_sub
CONNECTION 'host=primary-db port=5432 dbname=appdb user=replicator password=secret'
PUBLICATION app_pub;Explanation
See summary for usage details.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Replication and WAL
Refresh subscription
Pull publication membership changes to the subscriber.
Create physical replication slot
Create a physical slot to retain WAL for a replica.
Drop replication slot
Remove a replication slot when it is no longer needed.