Receive replicated data in another Neon database
Cross-region or cross-project data movement
Neon · Const
In Neon logical replication, a subscriber is the destination database or platform that receives an initial data copy from a publisher and then ongoing row-level changes through a subscription.
In Neon logical replication, a subscriber is the destination database or platform. It initially receives a copy of the publisher's data, then receives subsequent changes through a subscription, which connects to the publisher and identifies the publication to consume.
CREATE SUBSCRIPTION subscription_name CONNECTION 'connection_string' PUBLICATION publication_name;| Name | Type | Description |
|---|---|---|
subscription_name | identifier | Unique name assigned to the subscription. |
CONNECTION | connection string | Connection string for the publisher database. |
PUBLICATION | publication name | Publication whose changes the subscriber receives. |
No value; it creates a subscription that receives replicated data.
CREATE SUBSCRIPTION my_subscription
CONNECTION 'postgresql://username:password@host:port/dbname'
PUBLICATION my_publication;Creates a subscription on the destination database that connects to a publisher and receives the publication's replicated data.
Cross-region or cross-project data movement
Migration from an external PostgreSQL provider
Continuous downstream data synchronization
A subscriber is the downstream database or platform that receives replicated data. It first receives an initial copy, then receives later changes from the publisher through a subscription.
Follow-up: What identifies the data flow? A subscription connects to the publisher and names the publication whose changes it should receive.
Create a subscription on the destination database with CREATE SUBSCRIPTION. The statement supplies a unique subscription name, a connection string for the publisher, and the publication name.
Follow-up: What must the connection string target? It must use the publisher's direct database connection rather than a pooled endpoint.
Logical replication transfers row-level data changes, including inserts, updates, deletes, and truncates, but it does not replicate DDL. Therefore, schema changes must be applied and coordinated separately.
Follow-up: For an additive schema change, which side changes first? Apply it on the subscriber before applying it on the publisher.
publisherpublicationsubscriptionCREATE SUBSCRIPTIONpg_stat_subscriptionlogical replication