Free Database Audit

Learn More

PostgreSQL migration

A rehearsed path to the right PostgreSQL target

In short: A PostgreSQL migration moves data, schema, behavior, security, and operations to a tested target. JusDB plans version upgrades and cross-engine conversions through compatibility assessment, target preparation, rehearsal, controlled cutover, logical validation, and rollback gates. The migration method and achievable cutover window depend on the source and workload.

This service owns PostgreSQL version upgrades and Oracle, MySQL, or SQL Server conversions. For provider selection and managed-cloud cutover planning, use the dedicated PostgreSQL cloud migration service.

Decision guide

Which PostgreSQL migration method fits the scenario?

Tool choice follows the migration constraints. No single method is the safest or fastest for every version, source engine, data set, or cutover objective.

ScenarioCandidate methodsWhat decides
PostgreSQL major-version upgradepg_upgrade, logical replication, or dump and restoreChoose from outage tolerance, version path, storage access, object compatibility, and rehearsal evidence.
PostgreSQL to PostgreSQL with a limited cutover windowNative logical replication or an appropriate migration servicePlan DDL, sequences, large objects, unsupported objects, replication capacity, and final write control separately.
Portable migration with a planned outagepg_dump and pg_restoreTest restore throughput, parallelism, required free space, ownership, extensions, post-restore statistics, and application acceptance.
Oracle to PostgreSQLOra2Pg plus a tested data-transfer methodMeasure conversion effort for PL/SQL, packages, types, partitioning, sequences, SQL behavior, and application dependencies.
MySQL or SQL Server to PostgreSQLConversion tooling, migration service, or a controlled custom pipelineValidate data types, collations, identity behavior, procedural code, SQL semantics, connectors, and business logic.
Six-phase method

How is a PostgreSQL migration executed?

  1. 1

    Assess the source and application

    Inventory schemas, extensions, data types, stored code, jobs, large objects, security dependencies, database size and change rate, application queries, operational requirements, and supported PostgreSQL target versions.

  2. 2

    Design the migration and acceptance plan

    Choose the target, migration pattern, cutover objective, validation method, change controls, observability, rollback boundary, responsible owners, and measurable acceptance criteria.

  3. 3

    Prepare and convert

    Build the target, convert incompatible schema and code, configure required extensions and roles, prepare data movement, and resolve compatibility findings before production cutover.

  4. 4

    Rehearse data movement and cutover

    Run a representative migration, record throughput and elapsed time, validate the target, exercise application tests, test rollback, and refine the runbook from observed evidence.

  5. 5

    Execute the controlled cutover

    Follow the approved runbook, control source writes as required, complete the final synchronization, verify cutover gates, redirect applications, and monitor errors and database health.

  6. 6

    Validate and hand over

    Complete logical and functional validation, compare performance to the agreed baseline, resolve defects, confirm backups and monitoring, document the new environment, and close rollback only after acceptance.

Technical guardrails

What must a PostgreSQL migration runbook get right?

Logical replication and DDL

Schema definitions and DDL are not replicated by native logical replication. A subscription is not automatically torn down by every schema change, but incompatible source and subscriber schemas can cause replication errors until the target is corrected.

Large objects in pg_dump

A full database dump includes large objects by default. Selective filters can affect inclusion, so the dump command and restore rehearsal must be reviewed for the actual object set instead of assuming large objects are always skipped.

What pg_checksums proves

pg_checksums manages and verifies physical page checksums for a PostgreSQL cluster. Source-to-target equality needs logical checks—such as scoped counts, aggregates, digests, constraints, sequences, and application-level verification.

Acceptance evidence

How is the migrated database validated?

Validation combines logical, functional, operational, and performance checks. The exact evidence set is agreed during planning so both teams know what permits cutover and what triggers rollback.

  • Schema objects, extensions, roles, privileges, ownership, and configuration dependencies
  • Expected table counts plus scoped logical aggregates or digests for critical data
  • Sequences, identity behavior, large objects, constraints, indexes, and partition boundaries
  • Critical reads, writes, jobs, reports, integrations, and application error paths
  • Query plans and latency for agreed critical operations under representative load
  • Backups, restore evidence, monitoring, alerts, maintenance jobs, and operational access
Questions

PostgreSQL migration questions, answered

How long does a PostgreSQL migration take?

The schedule depends on database size, change rate, source engine, object compatibility, network capacity, test coverage, change controls, and the acceptable cutover window. Discovery produces a phased schedule with rehearsal, acceptance, cutover, and rollback gates rather than a fixed duration before the source is assessed.

Can PostgreSQL migration downtime be minimized?

Often, but the achievable cutover window is workload-specific. Backup and restore, pg_upgrade, native logical replication, or a migration service each has different constraints. A minimal-downtime plan measures synchronization lag, controls writes during cutover, validates the target, and defines when to proceed or roll back.

Does PostgreSQL logical replication copy schema changes?

No. Native PostgreSQL logical replication does not replicate schema definitions or DDL. Compatible schema changes must be applied to the subscriber in a controlled sequence, and incompatible changes can stop replication until resolved. Large objects, sequence state, and some object types also need separate handling and validation.

How is source-to-target data integrity validated?

Validation can include scoped row counts, deterministic aggregates or logical digests, constraints, sequences, large objects, critical-query results, permissions, and application tests. PostgreSQL pg_checksums checks physical data-page checksums in a cluster; it is not a source-to-target logical comparison tool.

Can you migrate Oracle, MySQL, or SQL Server to PostgreSQL?

Yes. Cross-engine work includes object inventory, data-type mapping, schema conversion, stored-code and SQL remediation, data movement, application compatibility testing, and operational handover. Automation can accelerate conversion, but engine-specific behavior and business logic still require review and acceptance testing.

Does pg_dump include PostgreSQL large objects?

A full pg_dump includes large objects by default. Selective dumps and schema-only operations can change what is included, and the --large-objects option can be relevant when using selective filters. The restore rehearsal should explicitly verify large objects, ownership, privileges, extensions, and sequence state.

What does a PostgreSQL migration rollback plan contain?

The rollback plan defines a decision deadline, write handling, connection reversal, source readiness, data divergence risk, named owners, and verification steps. Whether rollback is safe depends on what writes reached the target after cutover, so the plan is tested during rehearsal rather than improvised during production change.

Evidence and review method

Technical review and primary sources

This migration guidance is reviewed against PostgreSQL documentation for upgrades, dump behavior, logical replication, replication restrictions, and physical page checksums. Tool selection, cutover objectives, and acceptance evidence remain specific to the source and target environment.

Editorial owner: JusDB Database Reliability Engineering team. Last reviewed . See the team and roles.

Service scope, timelines, availability targets, and outcomes depend on the workload, PostgreSQL version, topology, infrastructure, change controls, and validation method agreed for the engagement.

Define the migration evidence before the cutover

Share the source engine and version, target, size, change rate, extensions, application dependencies, cutover constraints, and test coverage. We will turn those facts into an assessment scope.

Scope the migration
Explore all PostgreSQL services

Need a different PostgreSQL service? Browse our complete offerings.