Databases•Mar 2026•5 min read

MySQL vs PostgreSQL

The two databases everyone learns first. One is simpler, the other is more powerful. Here's which one you should actually pick.

The short answer

PostgreSQL over MySQL for most cases. PostgreSQL wins for almost every new project in 2026.

  • Pick MySQL if running WordPress, using PlanetScale, or maintaining an existing MySQL codebase that works fine
  • Pick PostgreSQL if starting a new project. Any new project. Especially if you need JSON, geospatial, full-text search, or vector similarity
  • Also consider: If you're using Supabase or Neon, you're already on PostgreSQL. Good choice.

— Nice Pick, opinionated tool recommendations

The Real Difference

MySQL was built for speed and simplicity. PostgreSQL was built for correctness and features. In 2005, that tradeoff mattered — MySQL was meaningfully faster for simple queries.

In 2026, PostgreSQL has closed the performance gap while MySQL still hasn't closed the feature gap. PostgreSQL supports JSON operators, CTEs, window functions, full-text search, and geospatial queries out of the box. MySQL has bolted on some of these, but they feel bolted on.

JSON Support Is Not Even Close

If you're storing any JSON (and you probably are), PostgreSQL's jsonb type is leagues ahead. You can index individual JSON fields, query nested objects with operators like -> and ->>, and use JSON path expressions.

MySQL added JSON support in 5.7, but it's clunky. No partial index support on JSON fields, worse query syntax, and generated columns are the workaround for everything. If your app mixes relational and document data, PostgreSQL handles it natively.

Where MySQL Still Wins

MySQL is simpler to set up, simpler to administer, and simpler to replicate. If you're running a WordPress site or a simple CRUD app and don't need PostgreSQL's advanced features, MySQL works fine.

MySQL's replication story is also more mature in some deployment patterns. Galera Cluster, Group Replication, and the sheer number of MySQL DBAs in the market mean operational expertise is cheaper.

Also: if you're using PlanetScale, you're using MySQL (Vitess). Their serverless branching model is excellent.

The Managed Database Factor

On managed services, PostgreSQL is available everywhere MySQL is: AWS RDS, Google Cloud SQL, Azure, Supabase, Neon, Railway. The operational complexity argument for MySQL has largely evaporated.

Supabase built their entire platform on PostgreSQL. Neon offers serverless PostgreSQL with branching. These are the platforms developers actually want to use in 2026.

What People Get Wrong

The biggest myth: "MySQL is faster." This hasn't been meaningfully true since PostgreSQL 12. Modern PostgreSQL with proper indexing matches or beats MySQL on most workloads. The benchmarks people cite are usually from 2018.

The second myth: "PostgreSQL is harder." The learning curve is maybe 2 hours longer. You'll make that back in the first week when you need a feature MySQL doesn't have.

Migration Reality

If you're on MySQL and it's working, don't migrate for the sake of it. Migration is painful — data types don't map 1:1, stored procedures need rewriting, and ORM differences will bite you.

But if you're starting fresh? PostgreSQL. Every time.

Performance Benchmarks: PostgreSQL’s Query Planner Leaves MySQL in the Dust

Let’s talk numbers. In OLTP workloads, PostgreSQL’s cost-based query planner consistently outperforms MySQL’s rule-based optimizer on complex joins and subqueries. Real-world benchmarks from HammerDB show PostgreSQL handling 1.5x the transactions per minute on TPC-C-like workloads with 64 cores. MySQL’s query planner often chooses nested loop joins where hash joins would be better, leading to 3x slower queries on multi-table joins. PostgreSQL’s parallel query execution—available since 9.6—scans tables 4x faster on 8 cores than MySQL’s single-threaded approach for sequential scans. And don’t get me started on PostgreSQL’s BRIN indexes: they reduce index size by 95% on time-series data while maintaining sub-millisecond lookups. MySQL’s equivalent? Crickets. If you care about query performance at scale, PostgreSQL isn’t just better—it’s a different league.

Replication and High Availability: PostgreSQL’s Battle-Tested Streaming Replication

MySQL’s replication has been a mess for years. Group replication? Buggy and slow. Semi-sync replication? Latency spikes. PostgreSQL’s built-in streaming replication is rock-solid since 9.0. With synchronous replication, you get zero data loss at the cost of 1-2ms added latency—configurable per transaction. For high availability, Patroni + etcd gives you automatic failover in under 10 seconds, tested in production at thousands of companies. MySQL’s InnoDB Cluster? Requires MySQL Router, often fails to detect split-brain, and recovery takes minutes. PostgreSQL’s logical replication (10+) allows selective table replication, even across major versions—MySQL’s equivalent (binlog-based) is fragile and version-specific. Need multi-master? PostgreSQL’s BDR extension provides active-active with conflict resolution that actually works. MySQL’s NDB Cluster is a niche product with 10x the complexity. For HA, PostgreSQL is the mature choice.

Licensing and Cloud Costs: PostgreSQL’s BSD License Saves You Thousands

Here’s the math: MySQL’s GPL license forces you to either open-source your entire application or buy a commercial license from Oracle (starting at $2,000 per server per year). PostgreSQL’s permissive BSD license lets you embed it in proprietary software with zero fees. On cloud, the gap widens. AWS RDS for MySQL charges $0.295/hr for db.r6g.large; PostgreSQL is $0.275/hr—a 7% savings. But the real cost is vendor lock-in: MySQL’s proprietary features like Group Replication and HeatWave are only available on Oracle’s cloud or with a license. PostgreSQL’s extensions (pg_partman, pg_stat_statements) are open-source and run anywhere. Need to migrate off AWS? PostgreSQL’s logical replication and pg_dump work seamlessly. MySQL’s mysqldump often breaks with proprietary storage engines. Bottom line: PostgreSQL’s licensing saves you money upfront and prevents cloud vendor lock-in. That’s a win for your budget and your freedom.

Quick Comparison

FactorMySQLPostgreSQL
JSON SupportBasicExcellent (jsonb)
PerformanceFastFast
ExtensionsLimitedRich ecosystem (PostGIS, pgvector)
ReplicationMature, many optionsLogical + streaming
Standards CompliancePartialExcellent
Managed OptionsRDS, PlanetScale, Cloud SQLRDS, Supabase, Neon, Cloud SQL
Learning CurveEasierSlightly steeper
Full-Text SearchBasicBuilt-in, good

The Verdict

Use MySQL if: You're running WordPress, using PlanetScale, or maintaining an existing MySQL codebase that works fine.

Use PostgreSQL if: You're starting a new project. Any new project. Especially if you need JSON, geospatial, full-text search, or vector similarity.

Consider: If you're using Supabase or Neon, you're already on PostgreSQL. Good choice.

MySQL vs PostgreSQL: FAQ

Is MySQL or PostgreSQL better?

PostgreSQL is the Nice Pick. PostgreSQL wins for almost every new project in 2026. Better JSON support, better extensibility, better standards compliance, and the performance gap that MySQL once had is gone. MySQL is fine if you already have it, but there's no reason to choose it for something new.

When should you use MySQL?

You're running WordPress, using PlanetScale, or maintaining an existing MySQL codebase that works fine.

When should you use PostgreSQL?

You're starting a new project. Any new project. Especially if you need JSON, geospatial, full-text search, or vector similarity.

What's the main difference between MySQL and PostgreSQL?

The two databases everyone learns first. One is simpler, the other is more powerful. Here's which one you should actually pick.

How do MySQL and PostgreSQL compare on json support?

MySQL: Basic. PostgreSQL: Excellent (jsonb). PostgreSQL wins here.

Are there alternatives to consider beyond MySQL and PostgreSQL?

If you're using Supabase or Neon, you're already on PostgreSQL. Good choice.

🧊
The Bottom Line
PostgreSQL wins

PostgreSQL wins for almost every new project in 2026. Better JSON support, better extensibility, better standards compliance, and the performance gap that MySQL once had is gone. MySQL is fine if you already have it, but there's no reason to choose it for something new.

Related Comparisons

Disagree? nice@nicepick.dev