Can Postgres Replace Microsoft SQL Server
This post is about choosing a database for a new project, starting from scratch. Short answer: as a database engine, Postgres is fine. As a working platform, it depends on your CI/CD workflow and the tooling you need around the database.
Here is how I think about it after three decades of building software on both sides of this fence.
The question behind the question
"Which database should I start with?" is really three questions:
- What is the job? Nobody pays for SQL Server just to store data. We use it to work with data: stored procedures, set-based transformations, scheduled jobs, ETL and reporting, with business logic running right next to the data. Define that workload first, then ask whether Postgres can do it.
- Does it have the capabilities I need? The features my workload depends on today: procedures, scheduling, ETL, reporting, security, tooling. Nobody picks a database so they can leave it later, so the test is whether it does what I need now.
- What does it cost? It follows from the first two answers, because the job decides the formula. A steady, heavy workload is priced by how many CPU cores you keep running. A spiky one is priced by how often it is called and how heavy each job is, and there pay-per-use or serverless tiers can win. Licensing, hosting and people sit on top of that.
It depends on the job. Storing and querying data: easy. Working with data inside the database: Postgres handles the SQL and procedural code well, but not the platform around it (scheduling, ETL, reporting). The second question shows which side your workload is on. The third, cost, follows from the first two: you pay either for always-on CPU or for how often and how heavily you call the database.
Where Postgres is now
PostgreSQL 18 shipped on September 25, 2025. The headline is a new asynchronous I/O subsystem, which the project says has shown up to 3x faster reads from storage. It also keeps planner statistics across major-version upgrades, which removes one of the more painful post-upgrade slowdowns. Developer-facing additions include virtual generated columns, uuidv7(), OAuth 2.0 authentication, OLD and NEW in RETURNING clauses, and temporal constraints.
This is not the Postgres of 2010. Most of the "SQL Server can do it, Postgres can't" arguments I remember have quietly expired.
Where SQL Server is now
SQL Server 2025 reached general availability at Ignite in November 2025. Microsoft is positioning it as an AI-ready database: a native vector type, DiskANN-based vector indexes, model management from T-SQL, a native JSON type with indexing, regular expressions in T-SQL, built-in REST calls, and change event streaming. Fabric mirroring pushes data to OneLake for analytics.
It is a strong release, and it is aimed squarely at developers who already live in the Microsoft world.
Where Postgres wins
- Licensing. No per-core, per-edition or Software Assurance fees when you run it yourself. On a managed cloud service the license is built into the price, so this matters much less there.
- Portability. Linux, macOS, Windows, containers, and a managed offering on every major cloud. Less lock-in.
- Extensibility. Extensions such as PostGIS and pgvector, custom types, and several procedural languages.
- Standards and features.
JSONB, arrays, range types, partial and expression indexes, and transactional DDL (you can roll back a schema change).
Where SQL Server still wins
- CI/CD and source control. SQL Server's strongest win. The database lives in source control as a project, and the tooling generates the deployment for you. Postgres has no standard equivalent, so you hand-write and maintain migration scripts. Details in the section below.
- Tooling. SSMS, SQL Agent, SSIS, SSRS and Profiler form a tightly integrated, polished toolbox. In Postgres you assemble your own from pgAdmin, cron or pg_cron, and third-party tools.
- Microsoft integration. Active Directory and Entra, .NET, Power BI, Fabric. If your whole company runs on Microsoft, the friction is lower.
- Built-in enterprise features. Columnstore, in-memory OLTP, and mature Always On availability groups are packaged and supported as one product.
- One throat to choke. A single vendor is accountable for everything. With Postgres you choose a managed provider or a support company for that role.
- Tiers. SQL Server's editions and service tiers let a small workload cost far less than an average mid-range tier. Postgres has no such gradient: it is the same engine everywhere, so the cost at the small end is set by the hosting you pick, not by a cheap entry edition.
Postgres is still catching up
The storage engine and SQL core of Postgres are very mature. The layer around them, the features that large enterprises expect in the box, is younger, and Postgres has spent the last several releases closing gaps that SQL Server closed long ago:
- Stored procedures with transaction control arrived in PostgreSQL 11 (2018). T-SQL has had procedures since its earliest days.
MERGEonly arrived in PostgreSQL 15 (2022). SQL Server has had it since 2008.- Virtual generated columns are new in PostgreSQL 18. SQL Server has had computed columns for decades.
OLDandNEWinRETURNING(PostgreSQL 18) is Postgres's answer to theOUTPUT inserted/deletedclause in T-SQL.- Temporal constraints (PostgreSQL 18) move toward the temporal tables SQL Server introduced in 2016.
- OAuth 2.0 authentication (PostgreSQL 18) is the single sign-on story that SQL Server gets through Active Directory and Entra.
Each release brings Postgres closer to SQL Server, but the gaps that remain decide real projects, and the biggest is CI/CD. Without a standard way to define the database in source control and deploy it from a pipeline, every change costs hand-written migration scripts. For a team that wants the database defined by its source files, that is a serious drawback and can be a dealbreaker.
CI/CD and source control: SQL Server's biggest win
This is SQL Server's strongest win over Postgres, and the first thing I would weigh.
In SQL Server the database is a project in source control. Tables, procedures, views and triggers live as plain CREATE files, and the tooling (SSDT database projects, sqlpackage) compares that project to a live database and generates the deployment for you. You edit the desired state, and the tool works out the change. It plugs straight into Visual Studio, Azure DevOps and GitHub Actions.
Postgres has no standard equivalent. The mainstream workflow is migration scripts: for every change you write a numbered script by hand that moves the database from one version to the next, and you keep all of them forever. Tools such as Flyway and Liquibase can apply those scripts automatically from a pipeline, but a human still has to write every one of them by hand before the commit. In SQL Server you commit the desired state and the pipeline works out and deploys the change itself. State-based tools that diff files against a live database do exist (Atlas and pg-schema-diff, for example), but they are younger, less widely used, and not first-party. Stored procedures need your own rebuild step on top.
If you want your database defined by source files alone and can't afford to hand-write and maintain every migration script, SQL Server is the safer choice.
Cost comparison: a mid-size database
Take a mid-size database: 20 GB, used in bursts rather than around the clock. Both options would run in Azure. What would I pay?
| Option (20 GB database) | Cost per year | Notes |
|---|---|---|
| Azure SQL Database, free offer | $0 if awake 1 hour a day; about $209 at 4 hours a day; about $986 at 12 hours a day; about $2,153 at 24 hours a day. Storage is free (32 GB). | The free compute is 100,000 vCore-seconds a month. Figures assume 0.5 vCore while awake and about $0.00015 per vCore-second (my estimate). You can instead pause the database until next month, which costs $0 but makes it inaccessible once the allowance is used. |
| Azure SQL Database, Basic | not possible | 2 GB maximum. |
| Azure SQL Database, Standard S0 | about $180, storage included | About $15 a month at any usage level. 10 DTUs, up to 250 GB. |
| Azure Database for PostgreSQL, B1ms | about $144 + $45 storage (about $190 total) | Compute is about $12 a month (US East). 32 GiB is the smallest storage you can provision. Backups are free up to the size of the provisioned storage. |
These prices are approximate. I took them from third-party summaries, and the Postgres storage price is my own estimate (about $0.115 per GiB-month). Check the Azure pricing calculator before you commit.
What you pay, and what you feel, as calls increase. The $5 and $15 Azure SQL prices are fixed for the tier. You pay them whether the database gets one call a day or a million. What limits you is capacity. When the calls need more than the tier's 5 or 10 DTUs, queries slow down, and you fix that by moving to a higher tier, not by paying per call.
Postgres works the same way on price, with a different feel at the limit. The B1ms price is also flat per hour, no matter how many calls arrive. But the B1ms is a burstable server, built for databases that are mostly idle. While it sits idle it saves up credits, like a bank account, and busy moments spend them. If it stays busy for too long, the credits run out and the server can stop responding. You fix it the same way, by moving up to more vCores, which Microsoft says takes seconds. So with both databases, more calls do not raise the bill. They push you into a bigger tier, and the bigger tier raises it.
The free offer and serverless are the exception. They bill for the compute you actually use, per second, so call frequency matters directly: frequent calls keep the database awake and use up the free allowance.
For this workload the answer depends on how many hours a day the database is awake. If the application wakes the database for a few minutes at a time and then goes quiet, the free offer covers it. If the monthly allowance runs out, you choose between pausing the database until next month and paying standard rates.
Postgres on Azure has a price floor. The B1ms is about $12 a month for compute alone, roughly $144 a year before storage and backups, whether or not anyone uses it. I found no equivalent of serverless auto-pause for it. You can stop a flexible server, but Azure starts it again automatically after 7 days unless you start it yourself first. The burstable tier is also meant for workloads that stay idle or below baseline: if CPU stays high the credits run out and the server can become unreachable, and Microsoft describes the tier as primarily for non-production use.
Two things can change the picture:
- Sharing. One Postgres server can host many databases, so if all your projects sit on one server the $12 is shared. SQL Server's free offer is per database.
- Constant load. If the application hits the database around the clock, the free SQL allowance (about 28 hours of one vCore) is gone quickly and you would be paying standard serverless rates. I did not find a current per-second rate, so price both options in the Azure calculator at your real load before deciding.
Bottom line: Postgres is not cheaper. That it is cheaper is a common myth. The software is free, but on a managed cloud service you pay for compute and storage, not for a license, and SQL Server's license is built into its price either way. At 20 GB the cheapest SQL Server option matches or beats Postgres at every usage level: free up to about 2 hours awake a day, then Standard S0 at about $180 a year against about $190 for Postgres. The gap at S0 is small, so read it as about even at best for Postgres, and never clearly cheaper. For the free offers that make this work, see Hunting Freebies in the Clouds, which compares the free database and compute offers from Azure, Google, AWS, Oracle and Cloudflare.
A practical way to decide
I would choose Postgres when:
- The database is small and mostly tables and views that never change or evolve.
- Licensing is a meaningful line item, or you are being squeezed on cores.
- You want to run the same database on any cloud or on a laptop.
- Your team already knows Postgres, or wants to.
I would choose SQL Server when:
- Your SQL schema changes frequently and CI/CD is important: you want the database defined in source control and deployed from a pipeline without hand-written migration scripts.
- Much of your business logic will live in stored procedures.
- You want SSIS, SSRS and SQL Agent as part of the platform.
- The company is committed to the Microsoft stack, Fabric and Power BI included.
If you are on the fence, weigh CI/CD first.
Verdict
Postgres can be used for a tiny project with basic needs for some data persistence. For anything bigger, the choice depends on the job, the capabilities you need around the database, and above all your CI/CD workflow, which is where SQL Server wins most clearly. If you want to push a commit and have the database deploy itself, start with SQL Server.
Sources
- PostgreSQL 18 release announcement
- PostgreSQL 18 release notes
- SQL Server 2025 has arrived (SQLServerCentral)
- Microsoft announces general availability of SQL Server 2025 (Neowin)
- Deploy Azure SQL Database for free (Microsoft Learn)
- Azure SQL Database free offer overview (Microsoft Tech Community)
- Azure SQL Database pricing by tier (Flexera)
- Azure SQL Database service tier costs (SQLServerCentral)
- Azure Database for PostgreSQL B1ms pricing (Bytebase)
- Compute and storage concepts for flexible server (Microsoft Learn)
- Shut down Azure PostgreSQL without automatic restart (Microsoft Q&A)