Comparison

PostgreSQL vs SQL Server: Features and Migration

Compare PostgreSQL and Microsoft SQL Server (MSSQL) by workload, licensing, isolation and tooling. Use a repeatable compatibility and cutover plan.

Editorial update

Decision in brief

Keep SQL Server when business-critical T-SQL, jobs, reporting integrations or failover runbooks are costly to replace and current performance meets targets. Start with PostgreSQL for a new SQL application that values its extension ecosystem or lacks Microsoft-specific dependencies. For a migration, require a testable gain after counting feature rewrites, operating costs, recovery and rollback.

Name the migration gain: SQL Server — Keep dependencies. PostgreSQL — Test extensions. Migration — Prove rollback.
Count feature rewrites and operating costs. Test recovery and rollback before switching.

See discussion trends ↓

PostgreSQL vs MSSQL by deployment and workload

Compare the exact offerings you would operate. Self-managed SQL Server, Azure SQL Database and Azure SQL Managed Instance differ in capabilities and operations; a managed PostgreSQL service can also restrict extensions or administrative access.

Your situationStarting pointDecision gate
An established app with T-SQL stored procedures, jobs and reporting dependenciesKeep SQL Server and optimize measured slow paths firstInventory each dependency and estimate rewrite, on-call training and rollback costs.
A new service with portable SQL and a needed PostgreSQL extensionPrototype on the exact PostgreSQL service or distributionVerify the extension version and reproduce it in a restore. Compare total cost and support at realistic load.
High-volume queries or a batch window that keeps slippingMeasure the expensive workload before choosing either engineCompare equivalent indexes, durability and resources; inspect spills, blocking, p99 latency and batch completion time.
An application must ship on both enginesKeep separate SQL adapters for engine-specific behaviorUse one suite for constraints, statement results, locking and recovery and run it against both backends.

Isolation, Query Store and cost: avoid mismatched baselines

PostgreSQL defaults to READ COMMITTED with a new snapshot per statement. In SQL Server, READ COMMITTED can use locking or row versions depending on the database's READ_COMMITTED_SNAPSHOT setting. Row-versioned READ COMMITTED gives statement-level views; the separate SNAPSHOT isolation level can give a transaction-level view. Matching the label alone does not ensure reads wait for the same writes or return the same results.

Use SQL Server Query Store to locate recurring plan and runtime regressions on the incumbent. Compare those queries with PostgreSQL execution plans, rather than timing a fresh query on an empty database. Estimate both systems with support, replicas, storage, backup retention and staffing. Use the official SQL Server edition matrix for any required features and applicable production licensing; Developer editions are for development and testing.

What the Hacker News cases add

SqlFlow maintainer bytefish showed a workflow engine with PostgreSQL and SQL Server backends. They described using PostgreSQL LISTEN/NOTIFY or SQL Server Service Broker for notifications while keeping durable workflow state in the selected SQL database. This is a practical pattern for portability: test equivalent wake-up and retry behavior behind separate adapters. The Show HN gave no comparison of production latency or recoverability.

In an episode submitted to HN by clairegiordano, Microsoft engineer Panagiotis Antonopoulos described moving from SQL Server engineering to PostgreSQL after 13 years. He found high-level concepts familiar but noted differences in recovery and lower-level behavior. Keep the team's conceptual knowledge, then rehearse the specific PostgreSQL commands and monitoring used for a restore or performance incident.

A staging test and rollback plan

A converter can help with syntax, but test operational behavior and application semantics separately. Keep an explicit fallback deadline, an acceptable downtime budget and a plan for writes that land after cutover.

  1. Inventory stored procedures, jobs, identity columns, collations, date and time types, SQL hints, driver settings and reporting dependencies. Rank each by business impact and choose the three most expensive rewrites for the proof of concept.
  2. Load the same anonymized data with representative skew. Assert ordering, case-insensitive unique behavior where required, UTC conversions and decimal totals. Use two sessions to verify what a reader sees during an uncommitted write and whether it blocks. Rehearse duplicate submission and deadlock retry.
  3. Replay production-like query parameters at peak concurrency with comparable durability. Save per-query p95 and p99, blocking, failures and plans. Set maximum downtime and data-loss limits, restore a backup to a fresh environment and run the fixture again.
  4. Rehearse a cutover using a bounded write freeze or validated incremental replication. Compare totals by key range, application invariants and the final watermark. Define how to reconcile target-only writes before routing traffic back to the source.

Related articles