Glossary

SQL Server vs PostgreSQL: a practical comparison

SQL Server is Microsoft's commercial relational database, with its own T-SQL dialect; PostgreSQL is an open-source relational database run by a community project. Both handle transactional workloads at scale; they differ most in licensing, default concurrency behavior and SQL dialect.

Side by side

SQL ServerPostgreSQL
LicenseCommercial, per core; free Express and Developer editionsPostgreSQL License (permissive), no license fees
PlatformsWindows and LinuxLinux, Windows, macOS and other Unix systems
Default concurrencyLocking read committed; row versioning (RCSI, snapshot isolation) is opt-inMVCC always; readers never block writers
Procedural languageT-SQLPL/pgSQL, plus others through extensions
Row limitingTOP n, or OFFSET ... FETCHLIMIT n, or OFFSET ... FETCH
UpsertMERGEINSERT ... ON CONFLICT; MERGE from version 15
JSONFunctions over text columns (JSON_VALUE, OPENJSON)json and jsonb types, jsonb indexable with GIN
Analytics featuresColumnstore indexesBRIN indexes, extensions
High availabilityAlways On availability groups, log shippingStreaming and logical replication; failover through tools such as Patroni
Identifier caseDepends on collation, usually case-insensitiveUnquoted names fold to lowercase

Concurrency: locks vs versions

This is the difference engineers notice first. By default SQL Server's read committed level takes shared locks, so a long update can block readers of the same rows. Turning on READ_COMMITTED_SNAPSHOT switches it to row versioning, with old versions kept in tempdb. PostgreSQL always uses MVCC: each statement sees a snapshot, and old row versions stay in the table until VACUUM reclaims them.

Dialect differences

Most porting work is small syntax. String concatenation is + in T-SQL and || in Postgres. T-SQL quotes identifiers with [brackets]; Postgres uses double quotes. Date functions differ in name and argument order.

SQL Server
SELECT TOP 10 first_name + ' ' + last_name AS full_name,
       DATEDIFF(day, hired_at, GETDATE()) AS days_employed
FROM dbo.employees
ORDER BY hired_at DESC;
PostgreSQL
SELECT first_name || ' ' || last_name AS full_name,
       current_date - hired_at::date AS days_employed
FROM public.employees
ORDER BY hired_at DESC
LIMIT 10;

Typical use

SQL Server fits organizations already on the Microsoft stack: .NET applications, Active Directory authentication, SSIS and SSRS, and Azure. Its license cost is real at scale, and the tooling around it is integrated. PostgreSQL is the default for new open-source and cloud-native applications, with managed versions on every major cloud and a large extension ecosystem. Teams moving off SQL Server usually spend most of the effort on stored procedures written in T-SQL, not on the tables. For analytics on either, see OLAP vs OLTP.

In Thunderduck

Thunderduck connects to both: SQL Server over ODBC, PostgreSQL as its own catalog type, and one query can join the two. SQL Server catalogs are read-only: INSERT, UPDATE, DELETE, MERGE and DDL are refused whatever the login allows. Filters and LIMIT are pushed down to SQL Server except LIKE, and comparisons there follow the database collation, so 'a' = 'A' can match. PostgreSQL catalogs are writable unless marked read-only.

A common pattern is copying SQL Server data into Postgres or Iceberg with INSERT ... SELECT, on a schedule. SQL Server catalogs are not available in dbt pipelines, and one query can reference at most 16 Oracle or SQL Server tables.

Docs: https://docs.thunderduck.ai/catalogs/oracle-sqlserver/

Related terms

Query the data where it lives.

Databases, warehouses and buckets in one SQL statement, from SQL clients, BI tools and AI agents.