Skip to content
METRIC OAK

New: the 3-week Data Platform Assessment: fixed fee, priced roadmap. See what's included →

SQL Server

SQL Server to PostgreSQL: what migration estimates miss, and whether the licence savings hold

SQL Server to PostgreSQL estimates usually price the schema and data and miss T-SQL logic, collation, SQL Agent and SSIS jobs, and retesting. A checklist for a realistic estimate and how to check the licence savings case.

Hemant Walchale

Hemant Walchale
· 5 min read

A thread on r/SQL about moving from SQL Server to PostgreSQL drew 60 upvotes and 51 comments. Most people agreed on one thing: the estimate covered tables and data, and the project overran on everything else. Here’s what estimates usually miss, and how to check whether the licence savings hold up.

The short answer

Price the logic, not the data. Count stored procedures, functions, triggers, SQL Agent jobs, SSIS packages and the applications that call them. Those counts, not the database size, decide the timeline. Then compare total cost over three years, not licence cost per year.

What estimates usually miss

Area Why it’s missed What to count
T-SQL logic Schema tools convert tables, not behaviour Procedures, functions, triggers, and how many actually run
Collation and case sensitivity Invisible until results differ Case-insensitive columns, unique keys on text, ORDER BY on text
SQL Agent jobs Not part of “the database” Jobs, schedules, alerts and operators
SSIS packages Often owned by another team Packages, connections, script tasks
Application code Embedded SQL, ORMs, drivers Inline queries, TOP, ISNULL, GETDATE(), [brackets]
Retesting Assumed to be quick Screens, reports and jobs that need sign-off
Running both Assumed to be a weekend cutover Months of dual running, sync and reconciliation

The T-SQL gap

Schema and data conversion tools (sqlserver2pgsql, AWS SCT, AWS DMS Schema Conversion, and others) handle tables, keys and bulk data well. Procedural code is different:

  • Postgres procedures don’t return a value; they pass data back only through output parameters. A T-SQL procedure that returns rows usually becomes a function with RETURNS TABLE, or returns a refcursor.
  • TRY/CATCH, temp tables, @@ROWCOUNT and OUTPUT clauses all need rewriting.
  • Dynamic SQL and cursors usually need redesign, not translation.

If there are hundreds or thousands of procedures, see converting thousands of stored procedures for a method: inventory, cut dead code, convert in dependency order, diff outputs.

Collation: the bug that shows up in production

SQL Server databases are often case-insensitive: the default collation for US English installs is SQL_Latin1_General_CP1_CI_AS, and CI means case-insensitive. In Postgres, all standard and predefined collations are deterministic, so text compares case-sensitively. After migration:

  • WHERE email = 'Ann@x.com' stops matching ann@x.com,
  • unique constraints allow duplicates that differ only in case,
  • sorting changes.

There are three fixes, each with a catch:

Fix Catch
Case-insensitive nondeterministic collation, per column ICU provider only, and it can’t be the database default, so you set it column by column. Comparisons are slower, B-tree deduplication is off, and some pattern matching isn’t possible. LIKE works with nondeterministic collations only from PostgreSQL 18.
The citext type An extension. The PostgreSQL docs now suggest considering nondeterministic collations instead.
Explicit lower() with matching expression indexes Every query has to follow the rule, including ones in application code.

Choose one rule and apply it everywhere before loading data.

Agent and SSIS need a new home

Postgres has no SQL Agent or SSIS. Options:

  • Jobs: the pg_cron extension (on Amazon RDS, see scheduling with pg_cron), or the scheduler you already use.
  • ETL: dbt for in-database transformations, plus an orchestrator or a managed ingestion tool for movement.

This is a rebuild, not a conversion. Estimate it separately. The SSIS migration guides cover the same problem for other targets.

Do the licence savings hold?

Build a three-year comparison:

Cost SQL Server (stay) PostgreSQL (move)
Licences and support Current core licences plus Software Assurance Zero, or managed-service premium
Hosting Current New, often similar
One-off migration None Conversion, testing, dual running
New tooling None Scheduler, ETL, monitoring
Skills Existing team Training, or hiring for Postgres

Savings are clearest when the licence estate is large and most logic can be simplified or retired. They’re weakest when the database holds a lot of business logic that has to be rewritten and retested line by line. Check Microsoft’s current licence terms and your own agreement before you compare.

A realistic estimate in four steps

  1. Run the catalog inventory (procedures, functions, triggers, jobs, packages) and record which objects ran over a full business cycle.
  2. Sort objects into simple, medium and complex, and time a sample of each type.
  3. Add the application changes and the retest plan, with sign-off owners.
  4. Add a dual-running period with daily reconciliation (see how long a data migration takes).

A lower-effort first step on AWS

Babelfish for Aurora PostgreSQL lets SQL Server clients connect over the TDS protocol and runs T-SQL “with some differences”, per AWS. It can shrink the application-change line of the estimate, but it doesn’t remove testing. AWS recommends running the open-source Babelfish Compass tool on your generated DDL to see how much of your T-SQL is supported, and lists the remaining T-SQL limitations. AWS describes Babelfish as an evolving Aurora PostgreSQL feature, so check the limitations for your version.

If the target is a cloud warehouse rather than Postgres, see SQL Server to Snowflake or SQL Server to Databricks.

Not sure where your own platform stands? Take the free 3-minute data platform scorecard. Need people to do this alongside your team? See senior data engineers for hire. Unfamiliar terms are explained in the data engineering glossary.

Frequently asked questions

How long does a SQL Server to PostgreSQL migration take?

The schema and data often take weeks. The total depends on the amount of T-SQL logic (stored procedures, functions, triggers), SQL Agent and SSIS jobs, and how many applications need code changes and retesting. Count those first; they usually decide the timeline.

Is moving from SQL Server to PostgreSQL worth it for licence savings?

Often, but compare total cost, not licences alone. Add the one-off migration and retesting effort, new tooling for jobs and ETL, retraining, and any period of running both. Savings are clearest for large core-based licence estates and weakest where little T-SQL logic is being retired.

What replaces SQL Server Agent and SSIS on PostgreSQL?

Core PostgreSQL has no built-in equivalent. Teams use the pg_cron extension (offered on Amazon RDS for PostgreSQL, for example) or an external scheduler for jobs, and an orchestration or ETL tool (Airflow, Dagster, dbt, or a managed service) for SSIS packages. Budget for that rebuild separately.

Does collation cause problems in a SQL Server to Postgres migration?

Yes. SQL Server's default collation for US English installs (SQL_Latin1_General_CP1_CI_AS) is case-insensitive, while all of PostgreSQL's standard and predefined collations are deterministic, so text compares case-sensitively. Queries, unique constraints and sorting can return different results unless you add case-insensitive ICU collations per column, the citext type, or explicit lower() handling.

Have 30 minutes? Get a senior architect’s view of your data platform.

No sales deck. You talk to the engineer who would lead the work.

Book an architecture review
Hemant WalchaleYou talk to Hemant Walchale, founder145 published guidesProfiles: LinkedIn · Clutch · GoodFirms

Free, takes 20 seconds

Get your starter data platform roadmap

Pick your platform and your main goal. You get a 90-day plan written by senior data engineers: what to do first, next and after.

You’ll also get our monthly email (confirm it in your inbox). Unsubscribe any time. Privacy policy.