Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Neon · Const

Subscriber

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.

How it works

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.

Syntax

CREATE SUBSCRIPTION subscription_name CONNECTION 'connection_string' PUBLICATION publication_name;

Parameters

NameTypeDescription
subscription_nameidentifierUnique name assigned to the subscription.
CONNECTIONconnection stringConnection string for the publisher database.
PUBLICATIONpublication namePublication whose changes the subscriber receives.

Returns

No value; it creates a subscription that receives replicated data.

Key points

  • The subscriber is the receiving side of a publisher–subscriber replication arrangement.
  • Initial synchronization copies the publisher's existing data to the subscriber.
  • After synchronization, changes made at the publisher are streamed to the subscriber.
  • The subscriber uses a subscription as its downstream replication configuration.
  • The subscription both connects to the source and selects the publication to consume.
  • Subscription setup requires unique naming, publisher credentials, a connection string, and a publication name.

Common mistakes

  • Use a direct publisher connection rather than a pooled connection; the replication connection must remain persistent.

Example: Create a PostgreSQL subscription

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.

When to use it

Receive replicated data in another Neon database

Cross-region or cross-project data movement

Use Neon as the replication destination

Migration from an external PostgreSQL provider

Consume publisher changes in real time

Continuous downstream data synchronization

Interview questions

QWhat is a subscriber in Neon logical replication?

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.

QHow do you configure a subscriber?

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.

QWhat are the main replication boundaries for a subscriber?

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.

  • publisher
  • publication
  • subscription
  • CREATE SUBSCRIPTION
  • pg_stat_subscription
  • logical replication

Source: Postgres logical replication concepts - Neon Docs. Checked 2026-10-16.