PostgreSQL migration

A PostgreSQL migration moves schemas, code, data and applications from Oracle, SQL Server, MySQL or a managed database into PostgreSQL you run. This page explains what the work includes, what drives cost, and how to choose between your team and a partner.

On this page

Why teams plan a PostgreSQL migration in-house or with a partner

Most teams that move to self-hosted PostgreSQL decide between their own staff and an implementation partner based on two things: the source engine and the number of applications that depend on it. A team moving one small MySQL database with a handful of simple queries can often plan it internally. A team moving dozens of Oracle or SQL Server applications with stored procedures, proprietary SQL and tight cutover windows usually finds the work exceeds what its database administrators can absorb alongside daily operations. The trigger is typically a licence renewal, a managed service the organization wants to leave, or a platform retirement that forces the move on a fixed date.

A migration is more than copying data. It covers schema conversion, rewriting application code and stored logic that uses engine-specific features, transferring data, validating that results match the source, and running a cutover plan with a defined rollback. PostgreSQL is released under the PostgreSQL License, a permissive license similar to BSD or MIT, so the target database carries no license fee. The cost and risk sit in the source system: how much procedural code it contains, how many applications connect to it, and how much downtime the business will accept. Confirm those inventories before comparing quotes, because they determine the effort far more than the target does.

Ask each candidate partner, and check internally, how they will inventory the source estate, which conversion tools they will use and how they will prove that migrated data and queries behave the same. The PostgreSQL migration documentation covers upgrades between PostgreSQL versions, not cross-engine migrations, so treat any conversion approach as something to verify against your own workload. Decide early who owns application changes, who signs off on validation results and who holds the rollback decision during cutover.

What a PostgreSQL migration scope includes

A migration touches more than the data. The scope usually covers what the source database does, how it converts to PostgreSQL, how the data is moved and proven correct, how users connect, and how the switch and any fallback happen. Each part below produces a named deliverable, so the scope can be checked item by item before work starts.

Source assessment and inventory

The team inventories schemas, stored procedures, triggers, scheduled jobs, linked servers, reports and every application that reads or writes the database. Dependencies that nobody documented usually surface here, such as a nightly job that calls a procedure from another schema. Ask for the inventory to list each object, its owner, its callers and whether it is still in use. The deliverable is a migration inventory and a risk register that ranks objects by conversion effort.

Schema and data type conversion

Source types such as Oracle NUMBER, SQL Server DATETIME2 or MySQL ENUM and zero dates do not map one to one onto PostgreSQL types. Sequences, identity columns, collations, case sensitivity and constraint naming also need explicit decisions. The conversion should be reviewed against the source data, not only the metadata. The deliverable is a target schema, a type mapping document and the DDL scripts that build it.

Application SQL and code conversion

Vendor-specific SQL, procedural language, outer join syntax, date functions and pagination clauses often fail or change behavior on PostgreSQL. Stored procedures need to be rewritten in PL/pgSQL or moved into the application, and each change needs a test. Confirm which application releases will carry the changes and how the code is tested against the new schema. The deliverable is a converted code set, a list of behavior differences and the test results for each converted object.

Data transfer and validation

The data load needs a repeatable method, a row count and checksum comparison per table, and sample-based checks on values such as money, timestamps and text encoding. Initial load and change capture are separate steps, and the validation should run after each. Ask how large objects, binary data and sequences are handled. The deliverable is the transfer scripts, a validation report per table and a record of any rows that were rejected or transformed.

Authentication and access mapping

Source logins, roles and grants must map to PostgreSQL roles, and the connection rules must be written in pg_hba.conf. Use SCRAM for password authentication, since PostgreSQL 18 deprecated MD5 in favor of SCRAM, and confirm the TLS and certificate settings for each client group. Application accounts should get least-privilege roles, not copies of the source admin account. The deliverable is a role and grant map, a pg_hba.conf rule set and the access review record.

Cutover runbook, rollback and handover

The runbook sets the order of freezing writes, final synchronization, validation, DNS or connection string changes and application restarts, with a named owner for each step. A rollback path must be defined and tested before the cutover, including how writes made on PostgreSQL would return to the source. Handover covers operating notes, backups and the upgrade path. The deliverables are the signed-off runbook, a rollback test record and handover documentation.

What drives PostgreSQL migration cost and duration

This table lists the factors that move effort and schedule in a move to self-hosted PostgreSQL, with one way to reduce each. Read it before scoping, since most of the variation between quotes comes from these rows. The target version row matters most for long-term cost: pick a version that stays supported for its full planned life.

DriverWhy it moves effortHow to reduce it
Source engine and proprietary featuresProcedural code, sequences, identity behavior, GUID or UUID keys, and date and numeric types map differently on each engine. Oracle packages, SQL Server T-SQL and MySQL-specific syntax usually need the most manual conversion.Run a schema and code assessment early to count the proprietary constructs, and map types and identity behavior before writing any data transfer job.
Database size and churn during the migration windowLarge volumes take longer to copy, and a high write rate widens the gap that must be replayed or reconciled at cutover.Take a bulk initial load ahead of time, then use change data capture or logical replication to carry only recent changes through cutover.
Number of applications and integrationsEach client, driver, report, ETL job and vendor connection must be found, tested against PostgreSQL and repointed. Undocumented connections are the usual source of late surprises.Build an inventory from connection logs and configuration, and test each integration in a non-production environment before cutover.
Stored procedures and business logic to rewriteLogic held in the database must be rewritten, tested and kept in step with application changes. Volume here often dominates the schedule more than data movement.Rank routines by business criticality and usage, retire unused ones, and move logic to the application only where the team agrees on ownership.
Downtime toleranceA short cutover window requires replication, rehearsed switch steps and rollback planning. A window that allows an offline copy is much simpler to run.Agree the acceptable window in writing first, then choose the method (offline dump and restore or replication-based cutover) that fits it.
Environments and test dataEach test cycle needs representative data, masked where regulated, and separate environments for rehearsal. Missing or stale test data causes repeated cycles.Automate environment builds and masking, and schedule at least one full rehearsal of the cutover before the production date.
Compliance evidence neededAssessors may ask for change records, data handling controls, access reviews, validation results and proof of backup and restore in the new platform. Producing this evidence adds work across the project.Define the evidence list at scoping and capture it during the work, rather than reconstructing it after cutover.
Target PostgreSQL versionVersions leave support on fixed dates. The supported dates are 18 (to November 14, 2030), 17 (to November 8, 2029), 16 (to November 9, 2028), 15 (to November 11, 2027) and 14 (to November 12, 2026), per the PostgreSQL versioning policy. A target that ends support early forces another major upgrade soon after go-live.Choose a version that stays supported for its full planned life, and confirm the date against the versioning policy before scoping.

How a PostgreSQL migration moves through its phases

The sequence turns an inventory of the source database into a tested target that can take over production with a rehearsed, reversible cutover. Each phase ends with a named output the client reviews before the next phase starts.

  1. Run discovery and inventory

    DeployOpen reviews the source platform, including schemas, stored procedures, triggers, jobs, data volumes, connected applications, reporting extracts and the authentication model. The team identifies which features have no direct PostgreSQL equivalent and which applications depend on source-specific behavior. The client receives an inventory report listing every object, interface and dependency, with a risk rating for each item. The phase is complete when the client confirms the inventory matches what the business runs.

  2. Agree target design and version

    The team selects the PostgreSQL major version, hosting layout, backup approach, high availability needs, connection handling and identity integration based on the inventory and the client's support window. The supported versions and their end-of-life dates are checked against the planned go-live date, so the target is not born close to end of life. The client receives a target design document with decisions and open questions. The phase closes when the client signs off the design.

  3. Convert schema and code

    Schema objects, data types, procedural code and queries are converted to PostgreSQL, using automated conversion tools where they help and manual rewrites where they do not. Application data access is adjusted where the source behavior differs, such as null handling, sequences, case sensitivity and transaction semantics. The client receives converted code in version control and a list of items that need a business decision. The phase is complete when the converted build deploys cleanly to a test environment.

  4. Repeat trial migrations with validation

    The full data load is run into a non-production target several times, each run timed and logged, with defects fixed and the process repeated from a clean state. Validation compares row counts, checksums on key tables, constraint results, sample record content and the outputs of reference reports between source and target. The client receives validation results for each trial and a list of accepted differences. The phase is complete when consecutive trials pass the agreed checks without manual intervention.

  5. Rehearse cutover and go live

    The team writes the cutover sequence, including the point of no return, the rollback path, the application switch, the handling of changes made during the final sync, and the verification steps. The sequence is rehearsed on a copy of production conditions, and the timing from the rehearsal is compared with the agreed outage window. The client receives a signed cutover plan and the go-live is run from that plan, with the client's approvers present. The phase closes when the application is confirmed working on the new platform.

  6. Provide hypercare and handover

    After go-live, DeployOpen monitors performance, errors, backups and replication through an agreed watch period, and fixes defects found in production. Open issues are tracked and closed, and the decommissioning plan for the source is agreed with the client. The client receives a runbook covering operations, backup and restore steps, monitoring, the upgrade path and escalation contacts. Handover is complete when the client's own team accepts the runbook and the watch period ends.

How the work differs by source engine

Oracle migrations usually carry the heaviest code conversion load, because much of the business logic often sits in PL/SQL packages, procedures, triggers and sequences rather than in the application. Data types, date and number handling, outer join syntax, and Oracle-specific functions all need mapping, and some packages may depend on features such as scheduled jobs, advanced queuing or database links that have no direct equivalent.

  • Package and procedure inventory: List every package, procedure, function and trigger, and classify each as convert, rewrite in application code, or retire.
  • Data type and NULL semantics: Confirm how NUMBER, DATE, VARCHAR2 and empty strings map, since Oracle treats empty strings as NULL and PostgreSQL does not.
  • Dependent Oracle features: Identify use of database links, DBMS_ packages, scheduler jobs and advanced queuing, and decide how each will be replaced.
  • Sequences and identity: Decide how sequence values and identity columns will be set at cutover so keys do not collide.
  • Licensing and tooling scope: Confirm with your Oracle licensing terms and the conversion tool you plan to use which features it reads and which it flags for manual work.

Before committing to a plan, run the chosen conversion tool against your exact Oracle version and check its coverage report against your own inventory of objects.

How data and traffic move during a low-downtime cutover

The cutover starts with the source database live in production, which keeps serving the application while a bulk load copies its data into the self-hosted PostgreSQL environment. Change capture then keeps the target current, and validation gates compare row counts, checksums and business reports before anything moves. Only after those gates pass does a short write freeze let the final changes sync and the application switch over. The source stays intact on a rollback branch, so traffic can return to it if the new environment fails checks after the switch.

Data and traffic flow from the live source through validation to the PostgreSQL target, with a rollback path.

How to cut over with minimal downtime and a rollback path

The core decision in cutover is whether to accept a planned outage window or to run a sync-based cutover that keeps the source database live until a short final switch. A planned outage is simpler to rehearse and easier to reason about, but every minute of it is visible to the business. A sync-based cutover keeps replication running from the source into PostgreSQL, so the only downtime is the write freeze, the last catch-up and the switch of connections. The second approach demands more engineering: sequences must be reset, triggers and scheduled jobs must be disabled on one side, and the team must confirm that replication lag is zero before freezing writes. Choose the approach per system, based on the business tolerance for write pauses and on whether the source database and its change capture tooling can support continuous replication for the migration window. Confirm both choices with the application owners before the rehearsal, not during the night of the cutover.

Validation gates must pass before the write freeze, not after it. Row counts, checksums on critical tables, sequence values, constraint checks and a set of business reconciliation queries should all match between source and target while writes are still allowed on the source. Once writes stop, the team has little room to investigate a mismatch without extending the outage. Application connection strings and secrets are switched as a controlled change: the target host, port, database name and credentials should be stored in your secrets manager and referenced by the application, so the switch is a single, reviewed change rather than edits across many config files. Confirm that the PostgreSQL role used by the application has the privileges it needs and that password authentication uses SCRAM, not the deprecated MD5 method. Keep the old connection settings recorded so that they can be restored quickly.

The rollback plan must be rehearsed, because the moment writes land in PostgreSQL, returning to the source becomes a data problem. Either the team builds a reverse path, such as replicating changes from PostgreSQL back to the source for a defined period, or it accepts that writes made after cutover will be lost if the switch is reversed. Document which option applies to each system and who makes the call. The source should stay readable and backed up for a defined period after go-live, so that reconciliation and rollback remain possible; the length of that period is a business and compliance decision to agree in writing before the migration starts. Test the rollback during the rehearsal, including the connection switch back and the reverse data path, and confirm that the source backups can be restored. Ask your migration partner to show the rehearsal results before approving the production cutover.

What usually goes wrong in PostgreSQL migrations and how to prevent it

Most failed PostgreSQL migrations do not fail in the data copy. They fail in the logic, types and connection behavior that the source database handled silently and the target does not. Each card below names one failure, the prevention step and the check that proves it before cutover.

Hidden dependencies in stored code and jobs

Stored procedures, triggers, views, scheduled jobs and reporting scripts often call objects that nobody lists in the migration scope. Build an inventory from the source catalog and job scheduler, not from the application repository alone, and convert each object with a named owner. The check: run every converted routine and job against a copy of production data and compare outputs, and confirm the inventory count matches the source catalog.

Upgrade docs

Data type and collation differences

Numeric precision, date and timestamp handling, string comparison and sort order can change results without raising an error. Case sensitivity and accent handling in particular differ between engines and locales, which affects unique constraints, joins and ORDER BY output. The check: compare row-level checksums and sorted query results for representative tables, and confirm the database locale and collation with the business owners of each report.

Sequences and identity values not reset

Data copied with explicit key values leaves PostgreSQL sequences behind the maximum existing ID, so the first inserts after cutover fail with duplicate-key errors. The fix is to set each sequence from the maximum loaded value after the final data load, including identity columns and any sequences used in defaults. The check: after cutover rehearsal, insert test rows into every table with a generated key and confirm no duplicate-key errors occur.

Application SQL tied to source-engine behavior

Application code may depend on vendor-specific functions, implicit type conversions, pagination syntax, transaction isolation defaults or error messages that the source engine produced. These differences surface as runtime errors or subtly wrong results in code paths that tests rarely reach. The check: capture the SQL statements the application issues during a full test cycle, run them against PostgreSQL in a test environment, and review every statement that the conversion tool flagged.

Connection handling carried over from the source

Application pools tuned for the source database can open far more connections than a PostgreSQL server handles well, and session state such as temporary tables or session variables may not survive a pooler. Decide the connection model before cutover, whether direct connections or a pooler such as PgBouncer, and size limits against the target server. The check: run a load test at expected peak concurrency and confirm connection counts, wait times and error rates stay within the limits you set.

PgBouncer site

Secrets and login migration left to the last day

Service accounts, database users, passwords, certificates and connection strings often sit in scripts, vaults and configuration files that the migration team does not own. Moving them at the last minute forces rushed changes to credentials and exposes plaintext secrets in transit. Plan the target authentication method early, using SCRAM rather than MD5 for password logins, and rotate credentials as part of the cutover plan. The check: confirm every application and job connects with its new credential in staging, and confirm no MD5 password entries remain in the target authentication configuration.

Which migration work teams keep in-house and which they outsource

This table lists the main work areas in a move to self-hosted PostgreSQL, who usually leads each one and the skills it needs. Use it to decide which areas your team covers and where a partner adds the most value. Teams that already run PostgreSQL well often keep application testing and cutover ownership internal.

Work areaWho usually leadsSkills needed
Inventory of source objects, code and jobsSource-engine DBA with an application leadKnowledge of Oracle, SQL Server or MySQL catalogs, scheduled jobs and application data access
Schema and code conversionPostgreSQL DBA with a source-engine DBAData types, procedural code translation, sequences, collations and PostgreSQL SQL behavior
Data transfer toolingPostgreSQL DBABulk load and replication tooling, network sizing, handling of large tables and LOBs
Validation designPostgreSQL DBA with an application developerRow counts, checksums, sampled record comparison and business reconciliation queries
Application testingApplication developer, internal team in most casesDriver and ORM compatibility, query behavior, regression test suites and test data
Security and access mappingSecurity engineer with a PostgreSQL DBAMapping source users and roles, authentication methods such as SCRAM and TLS, least-privilege design
Cutover rehearsal and cutoverRelease manager, usually internalRunbook execution, rollback planning, timing of writes freeze and replication lag checks
Runbook authoringPostgreSQL DBA with a release managerStep-level procedures, decision points, owners and verification steps for each stage
Post-cutover supportPostgreSQL DBA, internal or retained partnerPerformance tuning, monitoring, backup verification and issue triage in the first weeks

What PostgreSQL costs to run after the migration is complete

The target database carries no license fee. PostgreSQL is released under the PostgreSQL License, a permissive license similar to the BSD or MIT licenses, so the recurring cost of running it is mostly hosting, staff time and any commercial support contract you choose to buy. Hosting and storage stay in your own cloud accounts, data centers or air-gapped network, so the bill for compute, disks, backup storage and network capacity is the one your infrastructure team already manages. Ask your team or a partner to size these against your data growth, because storage tends to grow faster than compute and backup retention multiplies it.

Staff time is the main recurring cost. PostgreSQL ships minor releases at least once every three months, and minor releases replace executables and require a restart without changing the storage format. Someone must own that patch cycle, test it against your application and schedule restarts. Each major version is supported for five years after its initial release, and the current supported set includes 14 (to November 12, 2026) through 18 (to November 14, 2030). Plan a major upgrade for each version before its end-of-support date, using pg_upgrade or logical replication. Logical replication can keep downtime to several seconds, but the upgrade still needs rehearsal, a rollback plan and regression testing, so budget engineer hours for it every year or two.

Some costs end on a schedule rather than recurring forever. Keep source-system licenses or a read-only archive of the old database for the rollback period you agreed, and confirm with your vendor what their license terms require during that window, since notice periods and minimum terms vary. Commercial PostgreSQL support is optional, and if you buy it, confirm in the quote what response times, patch backports and escalation paths it covers. Ask any partner for a written estimate of recurring staff hours for patching, upgrades and restore testing, so the total cost of ownership is compared with the managed database you are replacing on the same basis.

Questions buyers ask before hiring PostgreSQL migration help

How much does a PostgreSQL migration cost and what drives the price?

The cost depends mostly on the size and complexity of the source database, not on PostgreSQL itself. The main drivers are the number of schemas, stored procedures, triggers and packages that must be converted, how much application code uses vendor-specific SQL, the data volume and how fast it must move, how many environments need to be built, and how much testing the business requires. Licensing is a separate line: PostgreSQL is released under the PostgreSQL License, so there is no license fee to move, but you still pay for infrastructure, tooling and people. Ask for a quote built from a written scope that lists each object category, the test plan, the cutover window and the deliverables. One-time work covers assessment, conversion, data transfer, validation and cutover. Recurring costs appear after go-live in operations and support. We do not publish prices, and the quote follows from the agreed scope.

How long does a PostgreSQL migration take?

Duration is set by how much code and data must change and how many validation rounds the business needs, not by the amount of raw data alone. The biggest timeline factors are the amount of procedural code to rewrite, the number of applications that connect to the database, the availability of test environments, the time needed to agree on acceptable differences in query results, and the size of the cutover window. Data transfer itself is often the shortest phase when the network and hardware are adequate. Ask for a phased plan with named milestones: assessment, conversion, test loads, functional testing, a rehearsal cutover and the production cutover. Each phase should state what it depends on from your team. Any duration estimate should come from the written scope and your own environment, not from a generic figure.

Can our own team migrate the database without outside help?

Yes, many teams can, particularly when the database is small, the schema is simple and the team already runs PostgreSQL. The harder cases involve Oracle PL/SQL, SQL Server T-SQL or MySQL-specific behavior in stored logic, because these differ in data types, null handling, sequence and identity behavior, transaction semantics and built-in functions. Assess honestly whether your team has done a conversion of this kind, whether it can rehearse cutover repeatedly, and whether it can take on operations after go-live. Many organizations split the work: internal staff own the application and business validation, while an outside team handles assessment, conversion tooling, data transfer and the cutover runbook. Ask any partner to show the assessment output and the validation method before deciding.

What does the migration need from our team to start?

The engagement needs named owners and access before technical work begins. Typical inputs are:

  • Read access to the source database, including schema metadata and a representative set of data samples, under rules your security team approves
  • Confirmed source database version and the list of applications, reports and jobs that connect to it
  • Test environments with network paths to the source and target, and a defined test data policy
  • Business owners who can confirm acceptable results for key queries, reports and batch outputs
  • A cutover window agreed with the business, plus a rollback decision owner
  • Change approval and a contact for each application team

Ask the provider to list these inputs in the written scope so gaps are visible before the schedule is set.

Which PostgreSQL version should we target for the migration?

Target a version that is still within its support window on the day you go live, and plan for the next major upgrade from the start. According to the PostgreSQL versioning policy, supported versions are 18 (final release November 14, 2030), 17 (to November 8, 2029), 16 (to November 9, 2028), 15 (to November 11, 2027) and 14 (to November 12, 2026). Version 18 was first released on September 25, 2025, so it is the newest option and has the longest remaining support. Choose based on your application's driver and extension needs, your authentication requirements, and how long you expect to run the system. Confirm extension availability with the packaging you plan to use before fixing the version in the scope.

How is downtime kept low, and what happens if cutover fails?

Low downtime comes from preparing the target while the source is still live. Two common approaches are a bulk load followed by change capture, and logical replication, which the PostgreSQL upgrade documentation describes as working between different major versions for migrations with very short downtime. Replication from non-PostgreSQL sources depends on the tooling and the source engine, so confirm the method for your specific source. Before cutover, rehearse the full sequence at least once, measure the actual downtime, and write a rollback plan with a clear decision point. If cutover fails, the rollback plan should state how writes return to the source, how any data written to the target is reconciled, and who authorizes the decision. You should receive the runbook, the rehearsal results and the rollback procedure in writing.

What happens after go-live, and who runs the database?

After go-live, the database needs ownership for backups, monitoring, patching, performance and access. Decide before cutover whether your team or an outside provider will run these tasks. Minor PostgreSQL releases arrive at least every three months and must be applied, while major upgrades must be planned before the end of each version's support. Ask for a handover package that includes the architecture diagram, configuration files, the cutover record, validation evidence, backup and restore procedures, monitoring setup and an operations runbook. Ongoing support, upgrades and continuous testing can be arranged as a retainer if you want them outside your team.

How DeployOpen scopes, delivers and hands over a PostgreSQL migration

DeployOpen plans, implements, tests, documents and supports self-hosted PostgreSQL inside your own cloud accounts, data centers or air-gapped networks. Each migration is agreed as a fixed scope with written deliverables before work starts, and the result is a system your own team can operate and review.

How we scope

  • Inventory source engines, schemas, stored code, data volumes and application connection patterns before naming a target version.
  • Agree in writing which conversions, data transfers, validation checks and cutover steps are in scope and which are not.
  • Confirm the cutover window, rollback conditions and who in your organization approves go or no-go decisions.

How we build

  • Convert schema and procedural code, documenting each construct that needs manual rewrite or an application change.
  • Transfer data in rehearsals and compare row counts, checksums and sample results against the source system.
  • Rehearse the low-downtime cutover end to end, including the rollback path, and record the measured downtime for your review.

How we hand over

  • Deliver the configuration, runbooks, conversion decision log and validation reports as documents your team keeps.
  • Walk your DBAs and application owners through the cutover steps, rollback procedure and post-cutover checks.
  • Document the backup, monitoring and minor release procedures your team needs to run the new cluster after go-live.

How we support

  • Provide a post-cutover stabilization period within the written scope to resolve issues found in production traffic.
  • Offer ongoing support, upgrades and continuous testing as a retainer, priced from the agreed service scope.
  • Confirm with DeployOpen which support hours, escalation paths and response expectations apply before signing.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.