>

Pattern 04 · Modernization

SQL Server → PostgreSQL migration pattern

A production pattern for moving off SQL Server licensing onto PostgreSQL — assess honestly, convert deliberately, replicate continuously, and cut over only when validation proves parity.

$0
license cost for PostgreSQL — the economic driver
5
phases: assess → convert → replicate → validate → cutover
1
rehearsed rollback plan before any cutover

01 · PROBLEM

SQL Server licensing is a growing tax on growth

SQL Server licensing — per-core, with Software Assurance — scales with your success and penalizes modern architectures (more cores, more replicas, more environments). Meanwhile the ecosystem has moved: PostgreSQL now matches or exceeds SQL Server on most enterprise workloads, with extensions (PostGIS, pgvector, TimescaleDB, Citus) that turn it into a platform.

This pattern describes how to migrate production SQL Server estates to PostgreSQL without heroic cutovers — continuous replication, dual-run validation, and rollback plans that have been rehearsed, not just written.

02 · WHEN TO USE

Fit and anti-fit

  • License renewals are forcing the conversation, or growth plans multiply core costs.
  • You want cloud portability — PostgreSQL runs well on every cloud and on-prem.
  • Workloads are OLTP, mixed, or analytical with standard SQL and procedural logic.
  • The organization can fund conversion engineering, not just a "lift and shift."

Don't use it as a pure lift-and-shift: moving SQL Server-isms (linked servers, CLR, heavy SSIS) to Postgres without conversion just relocates the pain. And if your estate is deeply coupled to the Microsoft stack with no appetite for change, honesty beats a doomed migration.

03 · ARCHITECTURE

Reference migration flow

SQL Server to PostgreSQL migration patternSQL Server to PostgreSQL migration pattern: assess, convert schema, replicate data with change data capture, validate continuously, cut over with a blue-green switch, then optimize. Assessinventory · complexity · sizing Convert schemaT-SQL → plpgsql · types Convert codeprocs · jobs · SSIS/SSRS plan Replicate datainitial load + CDC Validatecounts · checksums · app tests Perf baselinecapture before you move Dual-run / shadowcompare outputs Cutoverblue-green · rollback ready Optimizevacuum · indexes · planner Rollback plantested rehearsal, not a document Decommissionlicense exit · archive App remediationdrivers · SQL dialect · ORM HA / DR on Postgresreplication · backups · PITR Ops runbooksmonitoring · on-call · upgrades Validation runs continuously from the first replicated row — not as a phase before cutover. The migration is done when the app can't tell the difference.

The spine of the pattern: replicate early, validate continuously, cut over late. Validation isn't a phase — it's a standing process from the first replicated row to decommission.

04 · COMPONENTS

What each piece does

ComponentResponsibilityBuild/buy notes
AssessmentInventory databases, score complexity (T-SQL, CLR, linked servers, SSIS/SSRS), size effort honestlyAutomated scanners (AWS SCT/DMS, ora2pg-style analysis) plus human review of the hard 20%
Schema conversionData types, constraints, indexes, sequences, partitionsAutomate the 80%; hand-convert edge cases (hierarchies, sparse columns, filestream)
Code conversionT-SQL → plpgsql: procedures, functions, triggers; Agent jobs → orchestrator; SSIS → ELTThe long pole. Budget per-procedure, and simplify logic where the business allows
Replication (initial + CDC)Bulk load then continuous change capture with lag monitoringDebezium, AWS DMS, or Striim — pick for your topology, test failover
ValidationRow counts, checksums, data sampling, application-level dual-run comparisonDual-run is the gold standard: same inputs, compare outputs, investigate diffs
CutoverBlue-green switch with rehearsed rollbackRehearse the rollback like the cutover — an untested rollback is a hope
Postgres operationsHA (streaming replication), PITR backups, vacuum/autovacuum tuning, monitoringPlan ops from day one; Postgres rewards good operations and punishes neglect

05 · FLOW

How the migration proceeds

F1
Assess honestly. Automated inventory plus manual review of procedural code, integrations, and operational dependencies. Output: per-database complexity score and a sequenced wave plan — easy wins first.
F2
Baseline performance. Capture production query performance before moving. You can't prove parity without a baseline.
F3
Convert schema and code. Automate the mechanical 80%, hand-convert the tricky 20%. Remediate applications in parallel: drivers, SQL dialect differences, ORM quirks.
F4
Replicate continuously. Initial load, then CDC with lag alerting. Start validation immediately — counts, checksums, sampled row comparison.
F5
Dual-run. Route shadow traffic or replayed workloads to Postgres; compare results against SQL Server. Fix diffs until they're explained, not just small.
F6
Cut over blue-green. Switch with the rollback rehearsed and ready. Keep SQL Server warm until the retention window closes, then decommission and exit the licenses.

06 · TRADEOFFS

Decisions with real costs

DecisionOption AOption BOur default
StrategyBig-bang — one cutover, maximum riskWave-based trickle — longer program, contained blast radiusWave-based; big-bang only for trivial estates
Procedural codeConvert T-SQL → plpgsql faithfully — preserves behavior, preserves complexitySimplify/move logic to app — better long-term, more app workConvert faithfully first; simplify where the business signs off
Postgres flavorManaged (RDS, Cloud SQL, Azure) — less ops, some limitsSelf-managed — full control, full responsibilityManaged default; self-manage only with a real Postgres ops team
DowntimePlanned outage window — simpler, business costNear-zero via CDC + blue-green — more engineeringNear-zero for production; windows only for dev/test

On SQL Server → PostgreSQL specifically, see our in-depth migration guide.

07 · SECURITY

Non-negotiables

  • Lower environments: migrate with masked or synthetic data; production dumps in dev are how breaches start.
  • Credential rotation: new secrets for the Postgres estate — don't carry SQL Server service accounts across.
  • Encryption parity: TDE equivalents (disk-level + pgcrypto where needed), TLS everywhere, audit logging from day one.
  • Replication security: CDC channels are privileged — encrypt, authenticate, and monitor them like production access, because they are.

08 · GOVERNANCE

Running it like a program, not a project

  • Wave governance: each wave has entry/exit criteria; no wave cuts over until dual-run diffs are explained.
  • Rollback rehearsals: tested on schedule, timed, with named owners — a rollback plan that's never been run is fiction.
  • License tracking: track SQL Server license retirement per wave; the business case is realized at decommission, not at cutover.
  • Knowledge transfer: your DBAs and developers learn Postgres operations during the program, not after — pair with practitioners throughout.

09 · COST

Where the money goes

  • Conversion engineering is the dominant cost — procedural code conversion and app remediation, not tooling.
  • Dual-running doubles infra temporarily; budget it per wave and release SQL Server capacity aggressively after each decommission.
  • License savings are real but lagging — model the crossover point honestly, including the program cost.
  • Postgres ops (managed service fees or DBA time) replaces license cost; it's smaller, but it isn't zero.

10 · IMPLEMENTATION

A phased path that de-risks

P0
Assessment (2–4 weeks). Inventory, complexity scoring, wave sequencing, honest TCO model. Start with the Database Modernization Discovery questionnaire.
P1
Pilot wave (6–10 weeks). One representative database end to end: convert, replicate, dual-run, cut over. Proves the factory before scaling it.
P2
Scale waves (ongoing). Factory model: parallel conversion tracks, shared validation harness, wave-by-wave cutovers with rehearsed rollbacks.
P3
Optimize & exit (ongoing). Postgres performance tuning, decommission SQL Server, retire licenses, transfer ops knowledge.

Engagement tie-in: our Modernization practice runs these migrations as engineering programs, starting with a fixed-scope SQL Server → PostgreSQL assessment.

11 · RELATED

Keep exploring

SQL Server → PostgreSQL Guide

The in-depth migration guide: assessment, conversion, and cutover detail.

Read guide →

Lakehouse

Many migrations pair with a lakehouse for analytics — one modernization, two outcomes.

Read pattern →

Modernization Discovery Kit

The questionnaire we use to scope database modernization honestly.

Download PDF →

Start here

Talk to an Architect

Bring your hardest AI, data, or modernization problem. We'll tell you plainly whether we can help — and what it takes.

FAQ

Questions we hear

It depends on database count, procedural code volume, and application coupling — not data size. A single low-complexity database can move in weeks; estates with heavy T-SQL, SSIS, and linked servers run in phased quarters. The assessment phase exists to replace guessing with a measured plan.

Usually yes, using initial load plus change-data-capture with a blue-green cutover. Zero-downtime is an engineering outcome you design for — it requires dual-run validation and a rehearsed rollback, not just a replication tool.

They don't migrate — they get replaced. SSIS becomes your ELT/ingest layer of choice, SSRS reports move to your BI platform, and Agent jobs become scheduled tasks in your orchestrator. Plan this as part of conversion, not after.