Comparison: PostgreSQL vs SQL ServerModified date: Monday, June 30, 2025
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| intro | PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. | Microsoft SQL Server is a relational database management system (RDBMS). | |
| vendor | PostgreSQL Committees | Microsoft | |
| initial release | 1998 | 1989 | |
| latested version | 17 | 2022 (16.x) | |
| supported platforms | x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V, and PA-RISC | Windows, Linux | |
| db-engines ranking | 4 | 3 | |
| relational? | yes | yes | |
| open source? | yes | no | |
| license | commercial | ||
| price: box software | 0 | ||
| on-premise offering | yes | yes | |
| cloud offering | cloud vendors | SQL Azure and other cloud vendors | |
| technical doc | www.postgresql.org/docs | https://learn.microsoft.com/en-us/sql/sql-server/ |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| int: signess | signed only | ||
| int: 1-bytes int name | n.a. | tinyint | |
| int: 2-bytes int name | smallint | smallint | |
| int: 3-bytes int name | n.a. | ||
| int: 4-bytes int name | int | int | |
| int: 8-bytes int name | bigint | bigint | |
| decimal: storage size | variable | 5 to 17 | |
| decimal: range | up to 131072 digits before the decimal point; up to 16383 digits after the decimal point | from -10^38 + 1 through 10^38 - 1 | |
| char(n): max bytes | 10,485,760 | 8000 | |
| text: max bytes | 1G |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| SQL: standard complaince | high | high | |
| max SQL length | 64K | ||
| PL: main | SQL + PL/PgSQL | T-SQL (procedure support included) | |
| PL: other language support | yes | yes | |
| SP: max parameters | 100 | 2100 | |
| UDF: max parameters | 100 | 2100 | |
| SQL: max parameters | 65535 | ||
| SQL: query hints | GUC only | complete | |
| SQL: explicit locking | yes: row, page, table level | yes | |
| Triggers? | yes | yes | |
| Triggers: scope | tables, views, foreign tables | tables, views | |
| Triggers: type | BEFORE, AFTER, INSTEAD OF | AFTER, INSTEAD OF | |
| Object-Relational? | yes | some | |
| Extension Mechanism | C programming, link with engine | SQL level | |
| vector search | no native | ||
| SQL: max nested subqueries | 32 | ||
| Group By: max number of expressions | sum of all group by expressions bytes < 8060 |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| arch: server | C/S | C/S | |
| arch: run in browser? | no/yes | no | |
| arch: in-memory support | no | In-memory OLTP (Hekaton) | |
| arch: Multi-master support? | no | no | |
| arch: primary/read replica? | yes | yes | |
| replication: sync/async | both | both | |
| replication: WAL shipping | yes | yes | |
| replication: quorum-based commit | no | yes | |
| database: max number | |||
| tables: max number per database | 1,431,650,303 | ||
| partitions: methods | Range, List, Hash; limited composite (multi-level partitioning more limited than Oracle/SQL Server). | Range, List, Hash, Composite (nested partitioning supported since 2016). | |
| partitions: global index | no | ||
| rows: max rows per table | 32T/row_size | undefined | |
| index: max allowed index | rows per table is restricted by the number of rows that can fit onto MAX_UINT*8K pages. | ||
| ACID | yes/yes | yes/yes | |
| ACID: max isolation level | Serializable | ||
| ACID: max ANSI isolation level | Serializable | Serializable | |
| ACID: durability | yes | yes | |
| Materialized View: support? | yes | yes | |
| arch: clustering/HA | Always On Aaliablity Group, Failover clustering | ||
| index: max allowable size | 900 clustered index, 1700 non-clustered index | ||
| index: max number of fields | v14-17 allows 32 and 16 is allowed before that | ||
| partition: max allowed partitions |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| any official TPC benchmarks? | no | yes | |
| TPCC: most recent tpmC | |||
| TPCC: most recent submit date | 11/14/2011 | ||
| TPCC: most recent per thread perf | 37749 | ||
| TPCC: best tpmC | |||
| TPCC: best perf submit date | 8/27/2010 | ||
| TPCC: best perf per thread perf | 28240 |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| command line client | psql | sqlcmd | |
| admin(GUI) | pgAdmin |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| Jurisdiction | US | US | |
| ECCN | None | 5D992.c | |
| Eligible License Exception / CCATS | Not required | ||
| Encryption Components | SSL | TDE, SSL |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| concurrency control | MVCC | Locking + MVCC | |
| MVCC: implemented? | yes | yes | |
| MVCC: rollback segment | no | yes | |
| Implementation language | C | C++ |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| CBO? | yes | yes | |
| framework | System-R | Cascades | |
| join order search | dynamic programming + Generic Algorithm (GEQO) | Memo storage with a bunch of transformation rules like associative rule, commutative rule ec | |
| stats: multi column | yes | yes | |
| query hints? | GUC only | complete | |
| plan guide? | no | yes |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| resource management | simple: work_mem controls per-operator memory use | complete: per query grant | |
| spilling support | yes | yes | |
| model | Volcano + push for parallel run | Volcano + push for parallel run | |
| support intra-parallel query? | yes | yes | |
| adaptive execution (AQP)? | no | Adaptive joins, adaptive memory grants, etc | |
| vectorization | no native | yes | |
| iterator: join methods | all 3 | all 3 | |
| Error: out-of-range and overflow | abort the transaction | abort the transaction |
| Feature | PostgreSQL | SQL Server | Definition |
|---|---|---|---|
| Page Size | 8K default | 8K fixed | |
| Storage Compression | TOAST compression (within a row) | Row, page, and columnstore compression supported. | |
| Row Overflow / Large Row Handling | Row within a page and large columns pointing to TOAST storage | Row within a page and large columns pointing to LOB storage | |
| Index: primary cluster | Heap storage by default; CLUSTER command for static clustering - if modification happens after, order is not maintained. | Clustered index is default (one per table). | |
| Index: secondary | B+Tree, GIN, GiST, SP-GiST, BRIN, Hash, Fulltext (via extensions). | B+Tree, Bitmap, XML, Fulltext, Spatial, Columnstore. | |
| index: column store as primary | No native support; available via extensions (e.g. cstore_fdw, citus). | yes | |
| index: column store as secondary | No native support; available via extensions (e.g. cstore_fdw, citus). | yes | |
| partition table | declarative partition table is implemented via inheritance table, since V11 | complete | |
| partition table: prunning | mostly at compile time, some runtime | both | |
| ACID: durability mechanism | WAL | WAL | |
| index: pause and resume | yes |