The MySQL vs PostgreSQL debate has been going on for decades, and both databases have converged significantly in capabilities over the years. But there are still meaningful differences that should influence your choice in 2025 — especially around JSON support, concurrency, replication, and licensing.
Where PostgreSQL Has a Clear Edge
PostgreSQL is the more standards-compliant and feature-rich option. For most new projects starting in 2025, it is our default recommendation.
- JSON and JSONB: Postgres JSONB indexing is far more powerful than MySQL's JSON type — supports GIN indexes for complex JSON queries
- Full-text search: built-in FTS with tsvector/tsquery is more capable than MySQL's FULLTEXT indexes
- Advanced data types: arrays, hstore (key-value), ranges, composite types, custom types
- Window functions and CTEs: both are supported, but Postgres handles complex recursive CTEs better
- Partial indexes: index only rows matching a condition — huge performance win for filtered queries
- MVCC implementation: Postgres' MVCC never blocks reads, even during writes — better for mixed OLTP/OLAP
- Logical replication: more flexible than MySQL binlog replication for selective table replication
- True ACID: Postgres has always been fully ACID-compliant; MySQL's InnoDB is, but older engines (MyISAM) were not
Where MySQL Still Wins
MySQL is not a bad choice — it is an excellent database with a massive user base. It wins in specific situations:
- Read-heavy web applications: MySQL's read performance with simple queries is well-optimised
- Existing team expertise: if your team knows MySQL deeply, the operational risk of switching is real
- WordPress and PHP ecosystem: MySQL is the default for this ecosystem; Postgres works but requires more configuration
- Managed cloud options: AWS RDS MySQL, Azure Database for MySQL — both mature, well-documented
- Replication simplicity: MySQL primary-replica replication is simpler to set up than Postgres streaming replication
- Percona Server: drop-in MySQL replacement with enterprise features at no cost
JSON Performance Benchmark
For a table of 10 million rows with a JSONB/JSON column containing nested product attributes, querying for all products where attributes->color = "blue":
| Database | Without index | With GIN/FULLTEXT index | Index creation time |
|---|---|---|---|
| PostgreSQL 16 (JSONB + GIN) | 4,200ms | 12ms | 45 seconds |
| MySQL 8.4 (JSON) | 6,800ms | 180ms | 120 seconds |
| PostgreSQL 16 (JSONB, multi-path) | 4,200ms | 8ms | 90 seconds |
Licensing: The Oracle Factor
MySQL is owned by Oracle. This is a real risk consideration for organisations with long planning horizons. While MySQL Community Edition remains GPL-licensed and free, Oracle has the ability to change licensing terms for commercial editions — and has done so in the past with other products.
PostgreSQL is released under the PostgreSQL Licence, which is effectively a permissive BSD-style licence. There is no corporate owner that can change the terms. This is why many organisations — including Apple, Instagram (pre-MySQL migration), and GitLab — have standardised on Postgres.
MariaDB is a MySQL fork created by the original MySQL author after the Oracle acquisition. It is fully compatible with MySQL syntax and is a good alternative if you want MySQL compatibility without the Oracle dependency. Amazon Aurora is also MySQL-compatible and adds auto-scaling storage.
Migration: MySQL → PostgreSQL
If you are considering migrating from MySQL to Postgres, the main challenges are:
- AUTO_INCREMENT → SERIAL or GENERATED ALWAYS AS IDENTITY
- TINYINT(1) used as boolean → use BOOLEAN type in Postgres
- GROUP BY behaviour: MySQL allows selecting non-aggregated columns without including them in GROUP BY; Postgres (correctly) does not
- String comparison: MySQL is case-insensitive by default; Postgres is case-sensitive
- Date functions: NOW(), DATE_FORMAT(), IFNULL() have Postgres equivalents (CURRENT_TIMESTAMP, TO_CHAR(), COALESCE())
- Use pgloader (open-source) for automated migration — it handles most conversions automatically
Our Recommendation
New projects: use PostgreSQL. The JSON support, licensing freedom, and standards compliance make it the better long-term choice. Existing MySQL installations: keep them running unless you have a specific pain point (usually JSON querying or complex analytical queries). The cost and risk of migrating a working database is rarely worth it unless you are hitting concrete limitations.