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

Neon · Const

Logical replication

Neon logical replication enables PostgreSQL’s publisher-subscriber change streaming for a project. It permanently changes wal_level to logical and restarts all computes when enabled.

How it works

Neon enables logical replication at the project level, allowing PostgreSQL to emit row-level WAL information for logical decoding. After enabling it, configure PostgreSQL publications on the source database and subscriptions on the destination; Neon can serve as either side of the publisher-subscriber relationship.

Syntax

neon projects update $PROJECT_ID --enable-logical-replication --yes

Key points

  • Changing wal_level to logical gives PostgreSQL the row-level change information needed by logical decoding.
  • A Neon project may send changes as a publisher or receive them as a subscriber.
  • Initial synchronization copies a snapshot before ongoing changes are streamed.
  • After the snapshot, later source changes are delivered continuously as they happen.
  • Run SHOW wal_level; and confirm that the result is logical.

Common mistakes

  • Treat enablement as permanent: the project’s wal_level change cannot be undone.
  • Enabling the feature restarts every compute, so existing client connections are interrupted and must reconnect.
  • Use a direct compute connection for replication; pooled connections are unsupported.

Example: Enable and verify logical replication

neon projects update $PROJECT_ID --enable-logical-replication --yes

psql "$DATABASE_URL" -c "SHOW wal_level;"

Enables logical replication for the project, then verifies that PostgreSQL reports the required WAL level.

When to use it

Stream row changes to external data platforms

Change data capture

Move data between PostgreSQL environments

Database migration

Maintain a replicated project for regional failover

Cross-region resilience

Migrate data between PostgreSQL major versions

Version upgrades

Interview questions

QWhat does enabling logical replication change in Neon?

Neon enables logical replication per project. This changes PostgreSQL wal_level from replica to logical for every database in that project, providing the row-level WAL detail required for logical decoding.

Follow-up: What operational consequence follows immediately? The change is irreversible and enabling it restarts all computes, dropping active connections.

QHow does Neon logical replication transfer data?

Logical replication uses PostgreSQL’s publisher-subscriber model. The publisher first provides an initial data snapshot, after which changes are delivered to the subscriber as they occur in real time.

Follow-up: Which database objects complete the setup? Create a publication on the source database and configure a subscription on the destination.

QCan Neon be the source, destination, or both?

Neon can operate as either a publisher or a subscriber. To replicate data from Neon, enable logical replication on the Neon project; when replicating data to Neon, enable it on the source database instead.

Follow-up: What connection type should a replication client use? A direct connection to the compute endpoint is required because poolers do not provide the persistent connection logical replication needs.

  • wal_level
  • publisher
  • subscriber
  • publication
  • subscription
  • logical decoding
  • REPLICATION privilege
  • direct connection

Source: Logical replication in Neon - Neon Docs. Checked 2026-10-16.