Skip to main content

Comparison · Databases

PostgreSQL Logical versus Physical Replication

Physical replication applies WAL at cluster level; logical replication transfers selected table changes through publication/subscription. Logical replication supports table selection and…

Technical review:

Architecture and operating model

Physical replication applies WAL at cluster level; logical replication transfers selected table changes through publication/subscription. Logical replication supports table selection and migration scenarios but is not an automatic copy of all cluster objects.

Verify DDL, sequences, large objects and replica identity against the release documentation. Independent writes on a logical subscriber can conflict. Physical standby read roles, promotion and timeline management are separate operational steps.

Replication slots can retain WAL while subscribers lag. Replication is not backup: erroneous DELETE operations may propagate. Maintain independent backups/PITR and test real failover.

  1. 1Source transaction/WAL
  2. 2Publication/WAL stream
  3. 3Target apply
  4. 4Cutover/data validation
Document table/cluster scope.

Design parameters

Scope
Choose whole-cluster or selected-table scope from application needs.
Schema
Coordinate logical-replication DDL changes in the release process.
Lag/WAL
Distinguish received, written and applied positions; monitor slot-related storage.

Platform implementation

Service names are reference points. Scope, defaults, region availability and operating requirements differ; they are not interchangeable guarantees.

CriterionPhysicalLogical
ScopeCluster/WALPublication tables
SchemaPart of physical streamCoordinate DDL separately
Typical useStandby/failoverSelected data/migration

Worked example

Replicating only 30 GB of reference tables from a 500 GB cluster may fit logical replication; consider physical replication for a whole-cluster standby. Before cutover, prove the final commit is applied and check sequence values separately.

Troubleshooting

ObservationLikely cause / distinctionVerification
WAL storage growsSubscriber lag causes slot retention.Inspect retained WAL and apply lag.
New column absent on targetMissing DDL coordination.Compare schemas and deployment changes.

Acceptance checks

  1. Document table/cluster scope.
  2. Verify replica identity.
  3. Pilot DDL changes.
  4. Alert on WAL retention.
  5. Validate data at cutover.
  6. Retain independent PITR/backups.

Related concepts

Replication scope

Replication transfers data or state changes to another copy. Synchronous transfer can introduce latency and connectivity dependence; asynchronous transfer can lag behind. A current replica is not necessarily protected from incorrect changes: deletion and corruption can propagate too. Compare lag with the application’s last committed operation, not merely connection status. Define which copy receives write authority after the source is lost and how the old node is reconciled when it returns. Report replication lag and the actual recoverable point separately.

Transaction logs and recovery chains

WAL, redo and transaction-log mechanisms record changes in order for durability and recovery, with product-specific details. Data copies and logs must belong to compatible timelines and chains. Having log files alone does not prove point-in-time recovery: a valid starting backup and the required uninterrupted log range are also needed. Measure archival lag, log volume and replay time. Do not delete logs arbitrarily to regain space; use supported retention and cleanup methods.

Application consistency

A copy that boots does not prove application-data consistency. Operating-system caches, database logs and write ordering across disks or services affect the result. A crash-consistent copy resembles recovery after an unexpected shutdown; an application-consistent copy follows supported application preparation and write coordination. Validate transaction integrity, relationships between records and application behaviour after recovery, rather than only counting files. Confirm backup integration, application version and reported errors before assuming that consistency was achieved.

RPO and the actual loss window

RPO is the acceptable duration of data loss after an incident. A backup schedule alone does not prove it: failed jobs or delayed replication to another site can enlarge the window. Compare the incident time with the latest usable, consistent recovery point. If an incident occurs at 14:00 and the verified copy is from 13:20, the observed loss window is 40 minutes. Set targets per application; a file archive and a database receiving continuous orders may have different requirements.

Failover and failback

Failover moves service to another component; failback returns it to the preferred location. Their risks and sequencing may differ. DNS updates, routing, sessions, replication lag and application dependencies determine user interruption. Define failover triggers, false-alarm behaviour and approval for returning service. Simply shutting down a VM does not test every failure type. Measure network, storage and management-plane failures separately.

Dependencies and restart order

Services commonly depend on identity, DNS, time, networking, databases and licensing. Record a dependency graph describing conditions for operation, not merely an equipment list. Recovery order follows that graph; circular dependencies may require emergency access paths. Distinguish restored infrastructure from resumed business activity. Assign an owner, validation method and alternative access path to each dependency. Test assumptions by deliberately making one component unavailable in a controlled end-to-end exercise.

Primary documentation

Prepared by the Doz Teknoloji technical team using the primary references below. Calculations and lab scenarios state their assumptions; validate the applicable product version before rollout.

Knowledge Center

Enterprise IT Product Sales, Licensing and Deployment
Enterprise IT Project & Solution Scenarios
View all related content
Text on WhatsApp
Copied!