PostgreSQL’s documentation confirms that logical replication can move data between different major versions (official logical replication documentation). If you need a cross-version or cross-server migration with a shorter final cutover, evaluate PostgreSQL 18 logical replication first—provided your team can handle schema changes and objects it does not copy. It is not a zero-downtime guarantee, and it does not replace backup or restore testing.
This guide is for DBAs planning a PostgreSQL migration who want to limit the application write freeze.
It also helps SaaS technical leads planning target-server resources and backend engineers responsible for schema compatibility and cutover checks.
Last updated October 26, 2026. Technical details checked against the PostgreSQL 18 logical replication, upgrade, and monitoring documentation linked below.
Choose a migration path before preparing the target
Logical replication keeps the source available while the initial copy and ongoing changes are applied to a target. That can make the final write freeze shorter than a migration that copies everything only after writes stop. It does not eliminate the freeze: the team still needs a controlled point when the old database stops accepting writes and the target is verified.
Can PostgreSQL 18 use logical replication to migrate from an older version? Yes, PostgreSQL documents logical replication between different major versions. That does not mean every source-to-target combination, extension, or application behavior is automatically compatible. Check the official logical replication overview and the PostgreSQL 18 logical replication upgrade procedure against the exact source and target releases before committing to the method.
Consider alternatives when their trade-offs fit better. pg_upgrade can be a simpler path when you can make the database unavailable for the upgrade procedure and the source and target environments meet its requirements. A dump and restore is useful when you need a clean rebuild or a deliberately selective migration, but the copy and restore happen as planned migration work rather than continuous change replication. PostgreSQL’s pg_upgrade documentation describes its prerequisites and operating modes.
Logical replication is a poor fit when the application cannot tolerate a controlled write freeze, required extensions are incompatible, or the team cannot verify the objects that replication leaves behind. Decide the acceptable outage and rollback point first. Then choose the tool.
Before migration: inventory objects, compatibility, and capacity
Start with a written source-to-target inventory. Record the exact PostgreSQL versions, database encoding and locale, installed extensions, roles, schemas, tables, partitioning, and application connection settings. Check that the extensions needed by the application are available and compatible on the target. Do not assume that a successful table copy proves that application behavior will match.
Logical replication is based on publications and subscriptions, but it does not replicate every database object or schema change. The PostgreSQL logical replication restrictions explain the boundaries. In particular, schema and DDL changes need a separate process; sequence state and large objects also require explicit planning. Make a list of objects to create, copy, validate, or update outside the subscription.
Which objects need separate migration work? At minimum, review roles and privileges, schema definitions, extensions, sequences, large objects, and any tables or changes excluded from the publication. Treat this list as a migration deliverable, not a note to revisit after cutover. For each item, assign an owner and a validation method.
Assess capacity using measurements from the actual workload. Estimate database growth during the initial copy, the source WAL retained by replication slots, target storage consumed by copied data, and network capacity available while production traffic continues. The source documentation explains that slots can retain WAL until a subscriber has consumed changes, so a stalled or abandoned subscription can affect source storage. See the official logical replication configuration guidance.
Do not pick a universal disk-usage threshold or promise a catch-up duration. Measure write volume, database size, and network behavior in a rehearsal. Monitor available disk space on both servers and set an operational limit that triggers investigation before the source runs short of space.
Step one: prepare both databases and define the publication
Confirm that the target PostgreSQL service is running and reachable from the source. Set up network access and authentication using the least privilege compatible with the migration. Review the PostgreSQL quick setup instructions for the publication and subscription roles, connection settings, and required permissions.
On the publisher, logical replication requires appropriate server configuration. The relevant settings include wal_level, max_replication_slots, and max_wal_senders; the needed values depend on the existing workload and other replication consumers. Follow the official configuration documentation, and plan for a restart if a changed setting requires one. Do not paste generic values into a production configuration without checking the existing workload.
Create the target schema before starting replication. For a simple example, the publisher might define:
CREATE PUBLICATION app_migration
FOR TABLE public.accounts, public.events;
On the subscriber, create a subscription using a protected connection string and the publication name:
CREATE SUBSCRIPTION app_migration_sub
CONNECTION 'host=SOURCE_HOST dbname=APP_DB user=replication_user'
PUBLICATION app_migration;
Use a secret-management method suited to the environment rather than placing a real password in a shell history or shared migration document. Confirm that the publication contains the intended tables and that the subscription connects successfully. If the team uses an initial table copy, include it in the plan and allow time and capacity for that workload; initial synchronization is not instantaneous by definition.
Keep schema deployment under change control during synchronization. If the source application needs a DDL change, decide whether to pause that change, apply a compatible change to both sides in a safe order, or schedule the migration around it. A subscription is not a schema deployment system.
During synchronization: watch progress and resolve divergence
Once the initial copy begins, watch subscription activity, worker errors, source replication slots, source WAL retention, and disk space. PostgreSQL’s monitoring statistics documentation describes the available statistics views. A basic subscription check can start with:
SELECT subname, pid, received_lsn, latest_end_lsn, latest_end_time
FROM pg_stat_subscription;
And the source can be checked for slot activity:
SELECT slot_name, active, restart_lsn, confirmed_flush_lsn
FROM pg_replication_slots;
These views help show whether a worker is present and whether replication positions are changing. They are not a complete business-data validation. Interpret them alongside server logs and the application’s write behavior. A worker error, inactive slot, growing WAL retention, or stalled positions should trigger diagnosis before the cutover date is set.
How can the team tell whether the subscriber has caught up before cutover? Freeze or otherwise control writes first, then check that subscription workers are healthy, that the relevant replication positions have stopped falling behind, and that a known final change has arrived on the target. Include a migration marker in a published table if the application and schema allow it. Validate critical records and application behavior separately. A healthy subscription alone does not prove that excluded tables, sequence values, extensions, or schema changes are correct.
If replication fails, stop and identify the cause before restarting or rebuilding anything. Check connection and permission errors, missing target relations, incompatible schema changes, and source disk pressure from retained WAL. Repair the cause, verify the subscription state, and compare affected data before resuming the schedule. If the team cannot establish what data was applied, return to the rehearsal plan rather than treating a green connection as proof of consistency.
At cutover: freeze writes, validate, then redirect the application
Write down the cutover sequence and owners before the maintenance window. A useful order is:
- Put the application into maintenance mode or otherwise block new writes to the source.
- Drain or resolve outstanding write transactions using the application’s normal operational procedure.
- Confirm that the final source changes have reached the target, using subscription monitoring and a planned marker or equivalent validation.
- Check critical tables and application-specific invariants. Confirm schema, permissions, extension behavior, and sequence state.
- Switch application connections to the target using the team’s approved configuration process.
- Run read and write smoke tests, then watch application errors and database health before ending the maintenance mode.
This is not a promise that every migration can be completed within a fixed window. The duration depends on data volume, write rate, target capacity, network conditions, and the time needed to validate business rules. Use a production-like rehearsal to estimate the window and find steps that can be completed before writes are frozen.
Define the release and rollback conditions in advance. Do not reopen writes on the target until its data and application checks pass. Decide who can authorize the switch back, what event triggers that decision, and how writes made on the target will be handled if rollback is required. Once the target accepts new writes, simply pointing the application back to the old source can discard or split those new changes. A rollback plan must account for that divergence; it is not just a saved connection string.
After cutover: prove recovery and size the target for the workload
Keep the old source available according to the organization’s retention and rollback plan, but do not treat it as the only backup. Replication copies changes; it can also copy unwanted changes. It does not provide an independent recovery point by itself.
Plan backups outside the database host and test restoration. PostgreSQL’s continuous archiving and point-in-time recovery documentation describes the components used for PITR. A migration is not complete until the team has tested the recovery path it intends to rely on, checked that backups are accessible from outside the target, and recorded who owns restore operations.
Does logical replication replace a backup? No. It supports data movement and ongoing change replication, not a separate historical recovery copy. Keep an external backup strategy and perform a restore rehearsal on a separate environment or according to the organization’s recovery procedure.
Target hardware should be sized from the database’s measured memory use, storage growth, write workload, and replication or backup traffic. On a dedicated database server, direct NVMe storage and sufficient memory can be useful, but they do not make a migration safe by themselves. Check the actual HubAMD server specifications and current pricing and billing options rather than assuming that a particular configuration or price is available. The server is infrastructure for the database team to configure; it does not provide logical replication, automatic failover, or managed backups.
Before scheduling production work, use this checklist:
- [ ] Source and target versions, extensions, encoding, and application compatibility have been checked.
- [ ] Roles, schemas, sequences, large objects, and excluded tables have assigned migration and validation steps.
- [ ] Publication membership and target schema have been reviewed against the migration inventory.
- [ ] Replication slots, WAL retention, disk capacity, and network use have been monitored in a rehearsal.
- [ ] DDL changes during synchronization have a documented owner and deployment rule.
- [ ] The cutover has a write-freeze procedure, validation criteria, and an explicit rollback trigger.
- [ ] External backups exist, and a restore has been tested independently of logical replication.
Compare the migration path and server plan before committing
| Approach | When it can fit | Main operational trade-off |
|---|---|---|
| PostgreSQL logical replication | Cross-major or cross-server migration where the team can maintain compatible schemas and validate separately copied objects | Requires publication and subscription setup, monitoring, DDL coordination, and a controlled final cutover |
pg_upgrade |
A planned upgrade where downtime is acceptable and documented prerequisites are met | Avoids a long logical copy workflow but requires a suitable upgrade environment and a maintenance window |
| Dump and restore | Selective migration or a rebuild where the team wants to recreate the target deliberately | Copy and restore work must be planned; downtime depends on the chosen migration procedure and workload |
PostgreSQL 18 logical replication is the stronger candidate when the team can operate both databases during synchronization and wants to reduce the final cutover work. Choose pg_upgrade or dump and restore when their prerequisites better match the environment and a longer planned outage is acceptable. For any path, set the rollback boundary before the new target accepts production writes.
If the target will run a sustained database workload, compare its actual memory, direct NVMe, network, and billing options with the measured workload before ordering. Shared cloud instances may expose you to changing neighboring workloads, CPU allocation limits, or storage and traffic charges that are difficult to compare without a complete bill; managed databases may be preferable when reducing database operations work matters more than infrastructure control. Where dedicated resources and control over storage layout matter, review the available HubAMD database-server options. The team remains responsible for replication, redundancy planning, and off-host backups.
Further reading
HubAMD AMD EPYC 7543P dedicated server
From $448/month
