What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

PostgreSQL logical replication can feed a reporting database with selected table changes, and PostgreSQL lists analytical consolidation as a typical use case. But it is not a self-maintaining copy of a cluster: schema changes and sequence state are not replicated, subscriber-side conflicts can stop apply, and a lagging replication slot can affect publisher storage and recovery.

Use it when a reporting workload needs selected tables and you can operate a separate subscriber deliberately. The key is to plan schema rollout, object coverage, write permissions, conflict recovery, and slot health as part of the design—not as afterthoughts.

How logical replication works for reporting

A publisher defines publications; a subscriber creates subscriptions to receive changes. During initial synchronization, PostgreSQL normally copies a snapshot of each table, then sends ongoing changes. Within a subscription, changes are applied in publisher order, preserving transactional consistency for that subscription. See the PostgreSQL 18 logical replication overview.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

That makes logical replication useful when reports need a selected set of tables rather than a whole-cluster copy. The subscriber is still a PostgreSQL database and can technically publish data onward, but that does not make writes to subscribed tables safe by default: local changes can conflict with arriving changes.

What it does—and does not—replicate

Table data, including partitioned tables

Logical replication supports tables, including partitioned tables. With the default behavior, replication originates from publisher leaf partitions, so corresponding valid targets must exist on the subscriber. Publications can instead use the root table’s identity and schema with publish_via_partition_root. Check the partition layout on both sides before choosing the publication behavior.

Views, materialized views, foreign tables, and large objects

Views, materialized views, foreign tables, and large objects are not replicated. If reports rely on views or summary tables, create or refresh those objects on the subscriber through a separate process. Check explicitly for large-object dependencies rather than assuming they travel with table rows. PostgreSQL’s versioned PostgreSQL 17 restrictions documentation describes these limits; confirm restrictions for the major version you deploy.

DDL and schema changes

“The database schema and DDL commands are not replicated.” PostgreSQL 17 documentation states this plainly. Publisher and subscriber tables do not have to be identical in every respect, but the subscriber must accept incoming data. If a publisher change causes rows to become incompatible with the subscriber’s table, apply can fail until the subscriber schema is updated.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For many additive changes, applying the compatible change on the subscriber first can avoid intermittent errors. Treat every schema migration as a coordinated two-sided rollout: establish subscriber compatibility, deploy the publisher change, then verify apply health. Do not expect a publication to carry migrations.

Sequence state

Values already stored in serial or identity columns replicate as table data; the sequence object’s current state does not. That is usually immaterial while the subscriber is read-only. If it may become writable or be promoted during a switchover or failover, explicitly reconcile sequence values from the publisher or set them safely based on the table data as part of the cutover plan.

How subscriber writes and conflicts can stop apply

Logical apply behaves much like ordinary DML. Incoming changes can fail against subscriber constraints or permissions; row-level security can also matter. A reporting application that only reads subscribed tables avoids a common source of conflicts. If local writes are needed, define ownership and conflict handling deliberately rather than letting independent writers modify the same rows.

Some cases, such as an update or delete for a row that is missing on the subscriber, may be skipped; other conflicts, including unique-constraint violations, can stop replication. PostgreSQL records error details in subscriber logs and exposes conflict statistics through pg_stat_subscription_stats. The PostgreSQL 18 conflict documentation details the cases and monitoring view.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovery may mean repairing subscriber data or permissions, or skipping a transaction. Skipping is not a surgical removal of only the failing row: the entire transaction is skipped, including its otherwise non-conflicting changes. That can leave the subscriber inconsistent. Before skipping, use the error context and LSN to make a deliberate consistency decision, record it, and plan reconciliation after replication resumes.

Replica identity, truncation, and partition details

Updates and deletes need suitable row identity

Review replica identity for each published table that receives updates or deletes. A primary key or other suitable replica identity helps PostgreSQL identify changed rows. REPLICA IDENTITY FULL has a documented limitation for some data types that lack a default B-tree or Hash operator class, so check unusual column types before relying on it.

TRUNCATE and foreign keys

TRUNCATE is supported, but a truncation involving foreign-key-connected tables can fail on the subscriber if it reaches tables outside the subscription. Ensure the publication’s table set and the subscriber’s constraints are compatible with the operations the publisher will perform. These restrictions are covered in the PostgreSQL 17 restrictions documentation.

Replication slots, WAL retention, and capacity

A logical replication slot retains write-ahead log (WAL) that a subscriber still needs. If the subscriber falls behind, retained WAL can consume publisher storage. PostgreSQL 18 documents max_slot_wal_keep_size as unlimited by default. Setting a cap can bound retention, but if required WAL is removed after a slot falls too far behind, that subscriber may no longer be able to continue from the slot and may need recovery or reinitialization. The PostgreSQL 18 replication configuration reference describes the setting and worker limits.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Monitor publisher slot state and retained WAL alongside subscriber apply health. Include both ongoing change volume and initial table synchronization in capacity planning: table synchronization workers and apply workers share the logical replication worker pool. The documented default is a configuration value, not a sizing recommendation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep physical standby guidance separate

Settings such as max_standby_streaming_delay and hot_standby_feedback address query and recovery conflicts on physical hot standbys. They are not direct tuning controls for a logical subscriber. Logical-replica query isolation, resource sizing, and analytics-versus-apply tuning depend on the actual workload and deployed PostgreSQL version; measure them in that environment rather than transferring physical-standby advice unchanged.

Design and operations checklist

  • Define a narrow publication for the reporting tables required, and confirm every target is a supported relation.
  • Plan schema changes on both sides; for compatible additive changes, apply the subscriber change before the publisher change where appropriate.
  • Keep subscribed tables read-only to reporting clients unless there is a deliberate write-ownership and conflict strategy.
  • Confirm replica identity for tables that receive updates or deletes, especially when considering REPLICA IDENTITY FULL with unusual data types.
  • Review partition behavior and publish_via_partition_root on publisher and subscriber.
  • Add sequence reconciliation to any promotion or writable-subscriber procedure.
  • Monitor subscriber logs and pg_stat_subscription_stats for conflicts, and monitor slot state and WAL retention on the publisher.
  • Set an escalation and reconciliation procedure before anyone skips a transaction.
  • Validate initial synchronization, schema rollout, slot interruption, conflict recovery, and planned promotion against the deployed major version.

When a reporting replica is the right architecture

Choose based on the workload and operational responsibility, not just the word “replica.” Logical replication is a strong candidate when reports need selected tables, but it leaves schema, reporting objects, sequence state, conflict recovery, and WAL-slot health to your design. Compare it with a physical standby or a separately refreshed reporting copy using these questions:

  • Do reports need selected tables or a whole-cluster copy?
  • What freshness and replication lag are acceptable?
  • Does the subscriber need its own schema, views, or summary tables?
  • Can the team coordinate schema changes and respond to apply conflicts?
  • What publisher WAL retention and slot-recovery burden is acceptable?
  • Is failover or promotion part of the plan, including sequence reconciliation?

The answers determine whether selective logical replication’s flexibility outweighs its additional coordination and recovery work. The documented mechanics and restrictions vary by PostgreSQL major version, so verify them against the version you operate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.