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
· 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,@@ROWCOUNTandOUTPUTclauses 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 matchingann@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_cronextension (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
- Run the catalog inventory (procedures, functions, triggers, jobs, packages) and record which objects ran over a full business cycle.
- Sort objects into simple, medium and complex, and time a sample of each type.
- Add the application changes and the retest plan, with sign-off owners.
- 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.