Data platform · Database migration

PostgreSQL migration, with a parallel run before cutover

A PostgreSQL migration moves four things, not one: the schema, the code inside the database, the data, and the application queries that depend on them. The data copy is rarely what goes wrong. The risk sits in code that behaves differently on PostgreSQL and in a cutover that cannot be reversed. Interkey runs database migrations from Riyadh with an assessment first, a parallel run in which old and new systems stay in step, and a rehearsed rollback.

In short

  • What moves: schema, stored code, data and application queries, each with its own work.
  • Where risk sits: behaviour differences in code and queries, and a cutover with no way back.
  • How the outage is kept short: initial load, continuous replication, a parallel run, then a cutover in gated steps.
  • What the assessment can conclude: migrate, tune what you have, or do not migrate.
  • Where it runs: the replication bridge, the target database and the tooling can run on in-Kingdom infrastructure.
  • How it is priced: per engagement, after the assessment.

What a PostgreSQL migration actually involves

The four layers of a PostgreSQL migration
LayerWhat changesTypical effort
SchemaTables, data types, keys, indexes, sequences and constraints are translated to PostgreSQL equivalentsLargely automatable; type choices need review
Stored codeProcedures, functions, triggers and packages are rewritten for PL/pgSQLUsually the largest share of engineering work
DataInitial load, then continuous replication until cutover, with counts and checksums comparedDepends on volume, change rate and downtime window
ApplicationQueries, drivers, connection settings and error handling are tested against PostgreSQLSized per service; often underestimated

Moving from Oracle, SQL Server or MySQL: what usually needs rework

The source database decides where the work is. These differences commonly cause defects after a move. They are taken from the PostgreSQL documentation and, for empty strings, Oracle's documentation:

  • Stored code. PostgreSQL has no packages. The PostgreSQL documentation suggests schemas to group functions, and temporary tables for the per-session state that package variables used to hold. Procedural code from any source database is rewritten for PostgreSQL, usually in PL/pgSQL.
  • Data types. The PostgreSQL documentation advises replacing varchar2 with varchar or text, and number with numeric or a more suitable numeric type. Date and time types need the same review.
  • Empty strings. Oracle Database treats a character value with a length of zero as null. PostgreSQL does not, so comparisons and constraints that rely on this behave differently.
  • Identifier case. PostgreSQL folds unquoted names to lower case. Code that mixes quoted and unquoted names can stop finding its own tables.
  • Errors inside procedures. In PL/pgSQL, when an exception is caught, all database changes since the start of that block are rolled back. Error-handling code ported line by line can lose work it used to keep.
  • Dynamic SQL. EXECUTE works much as before, but names and values must be quoted with quote_ident and quote_literal, or the statement will not work reliably.

None of this is unusual. It is why the assessment reads the stored code and the application's queries before anyone quotes a duration.

Moving the data without a long outage

The pattern is the same whichever database you start from:

  1. Initial load. Copy the existing data to PostgreSQL.
  2. Continuous replication. Keep copying every change from the source while both systems run.
  3. Parallel run. Both databases live and in step, for as long as validation and the business require. Reads move first, in steps that can be reversed.
  4. Cutover. Writes move to PostgreSQL. Switching back stays possible until the agreed point.
Read more

Interkey uses iblync, its own data migration and replication platform built in Saudi Arabia, to run the bridge between the two databases. iblync replicates changes continuously, including bi-directional synchronisation where both sides accept writes. It controls its own rate so replication does not compete with production, and when the target is unavailable, changes queue rather than fail. Migration workflows are configured rather than hand-scripted, so your database team can review and repeat them.

iblync's published connector list includes Oracle, SQL Server, MySQL and PostgreSQL. Which source and target pair, version and edition your project needs is confirmed in the assessment. Where a system is not yet covered, custom connectors are built.

Cutover as a sequence of gates

Every step has a pass condition agreed in advance. Failing one routes to the rollback path.

Cutover gates for a PostgreSQL migration
GatePass condition
Freeze and final syncWrites paused or queued; replication drains the last changes
ValidationRow counts, checksums and application health checks match
Reads switchError rates and latency on PostgreSQL within agreed thresholds
Rollback decisionA named owner gives go or no-go; past this gate, writes move
Writes switch and monitorPostgreSQL is the system of record; the old database stays warm through a business peak

The cutover is performed once and rehearsed more than once, including the rollback.

When not to migrate

The assessment can conclude that you should not migrate, and it says so in writing. A working database that serves its load is an asset. Sometimes the better answer is to tune what you have. And when both systems come from one vendor with a supported native migration path, that path is usually cheaper than a heterogeneous migration, and iblync is the wrong tool.

How Interkey runs a PostgreSQL migration

  1. Assessment. A bounded piece of work: workload, stored code, application queries, data volume, downtime window and residency. The output is a decision with a costed comparison that includes staying put.
  2. Schema and code. Translate the schema, rewrite stored code, and test it against production-shaped data.
  3. Application changes. Size and start the query and driver changes per service, with your application teams.
  4. Bridge and parallel run. Initial load, continuous replication and service-by-service comparison.
  5. Rehearsed cutover. Cutover and rollback rehearsed, then performed once.
  6. Stabilise. Tuning, backup-restore proof and failover drills, then handover to your DBAs or operation by Interkey from Riyadh.

After the move, schema changes on PostgreSQL can be versioned and shipped through a pipeline. Interkey's database DevOps practice covers that step.

What drives the cost

Quotes are per engagement, after the assessment. The drivers are how far the schema and stored code are from PostgreSQL, the number of services whose queries change, data volume and change rate, the downtime window the business will grant, the deployment model, who carries the application changes, and operation after go-live. iblync itself is priced by quotation, per source system, target system and data volume.

Questions buyers ask

Which databases can you migrate to PostgreSQL?

iblync's published connector list includes Oracle, SQL Server and MySQL as well as PostgreSQL. Your exact source, version and edition are confirmed in the assessment.

Does the business have to go offline?

The pattern is designed to avoid a long outage: replication keeps both databases in step during a parallel run, so the cutover is a short, gated step rather than a weekend of downtime. The downtime window is agreed in the assessment.

Can the migration keep our data inside Saudi Arabia?

Yes. The replication bridge, the target database and the tooling can run on in-Kingdom infrastructure. Residency is settled in the assessment.

Can we switch back if something goes wrong?

Until the agreed rollback point, yes. The old database stays in step and stays warm, and the rollback is rehearsed before the real cutover.

How long does it take?

The assessment sets the schedule, because the stored code and the application queries decide it. A duration quoted before that analysis is a guess.

Who runs PostgreSQL afterwards?

Your DBAs, after handover, or Interkey from Riyadh under a written managed-services scope.

Next step

Book a migration assessment

Tell us the source database and version, the rough data volume, how much stored code it holds, and the downtime window the business will accept.

Required field

The Riyadh team reviews your request and a specialist replies on Saudi working days, in Arabic or English. Your details are used only to reply to you. Privacy Notice

Or directly

+966-11-2180999 [email protected]

Tawuniya Towers, North Tower, 7th Floor, King Fahad Highway, Olaya, P.O. Box 56835, Riyadh 11564, Saudi Arabia

or What usually needs rework

Published by Interkey. Last updated . Interkey is registered in Riyadh, Saudi Arabia under commercial registration 1010156897.