
Decision Summary
Neither engine wins everywhere; the right pick depends on the application. PostgreSQL is an object-relational engine built for extensibility, data integrity and concurrency. MySQL is a relational engine valued for speed, reliability and a very large third-party ecosystem. If your team, framework or hosting already revolves around MySQL, that alone is a legitimate reason to stay. If you expect complex queries, varied data types or specialized workloads such as geospatial or vector search, PostgreSQL usually has the more room to grow.
| Criterion | PostgreSQL | MySQL |
|---|---|---|
| Data model | Object-relational; native arrays, ranges and composite types | Relational; no native array type; pluggable storage engines, InnoDB by default |
| Concurrency | MVCC with row versions in the table; default Read Committed; true Serializable available | MVCC in InnoDB using undo logs; default Repeatable Read; gap and next-key locking |
| JSON indexing | jsonb with GIN indexes | JSON type; indexed through generated columns |
| Replication | Physical streaming and logical replication | Binary-log replication; Group Replication with automatic primary election (InnoDB Cluster) |
| Extensions | Large extension framework (PostGIS for geospatial, pgvector for vector search) | Fewer in-core extension points; storage-engine plugins |
| License | PostgreSQL License (permissive, similar to BSD or MIT); no commercial edition | GPLv2 or a commercial license from Oracle |
| Current release | PostgreSQL 19 (released 19 November 2026); five years of support per major version | LTS (8.4, 9.7) and Innovation tracks; LTS gets five years Premier plus three years Extended Support |
| Managed offerings | RDS, Aurora, Cloud SQL, Azure Database for PostgreSQL, DigitalOcean | RDS, Aurora, Cloud SQL, Azure Database, DigitalOcean, Vitess-based platforms |
| Typical fit | Complex OLTP, analytics-adjacent work, geospatial and vector data | Web applications, CMS backends, read-heavy OLTP, existing MySQL stacks |
SQL Standards Compliance and Data Types
PostgreSQL was designed as an object-relational system and tracks the SQL standard closely. Recursive common table expressions, window functions, full outer joins, array and composite types, and range types are all native. MySQL historically favored simplicity and speed over strict standards adherence. It added window functions and CTEs later, and by default it allows more permissive type coercion unless strict SQL mode is enabled.
The gap matters most for complex reporting queries or for schemas that rely on the database to enforce data shape. A simple lookup-table schema will not expose much difference; nested aggregations, custom domains or array columns will.
-- PostgreSQL: native array column, no extra table needed
CREATE TABLE articles (
id serial PRIMARY KEY,
tags text[] NOT NULL DEFAULT '{}'
);
SELECT * FROM articles WHERE 'postgres' = ANY(tags);
-- MySQL: no native array type; model tags as a JSON array
-- or a separate join table instead.
MVCC, Locking, and Transaction Isolation
Both databases use multi-version concurrency control, so readers and writers rarely block each other, but the implementations differ. PostgreSQL keeps multiple row versions in the table itself and relies on autovacuum to remove dead tuples. Its default isolation level is Read Committed, and it offers a genuine Serializable level built on serializable snapshot isolation. MySQL's InnoDB builds MVCC on undo logs over a primary-key-ordered clustered index. Its default is Repeatable Read, and it uses gap and next-key locking to close the phantom-read window.
Operationally, PostgreSQL administrators watch vacuum and table bloat on high-churn tables. InnoDB administrators watch for lock contention and deadlocks under concurrent writes, particularly with foreign keys and secondary indexes.
-- PostgreSQL: set isolation level right after BEGIN
BEGIN;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-- ...statements...
COMMIT;
-- MySQL: set isolation level before starting the transaction
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;
-- ...statements...
COMMIT;
JSON and Semi-Structured Data
Both databases store and query JSON natively, but indexing differs. PostgreSQL's jsonb type stores JSON in a decomposed binary form and supports GIN indexes for containment and key-existence lookups. MySQL's JSON type also stores a validated binary form, but indexing a path means creating a generated column over that path and indexing the column.
-- PostgreSQL: index and query inside a jsonb column directly
CREATE INDEX idx_attrs ON products USING GIN (attrs);
SELECT * FROM products WHERE attrs @> '{"color": "red"}';
-- MySQL: index via a generated column over a JSON path
ALTER TABLE products
ADD COLUMN color VARCHAR(32)
GENERATED ALWAYS AS (attrs->>'$.color') STORED;
CREATE INDEX idx_color ON products (color);For documents with a stable, known shape, both approaches work well. When documents are queried on many unpredictable keys, a single GIN index on jsonb is the more flexible tool, since MySQL needs a generated column per queried path.
Replication and High Availability
PostgreSQL offers physical streaming replication, which copies the whole cluster at the byte level and is the usual basis for read replicas and failover. It also offers logical replication, which works at the table and row level and suits selective replication, cross-version upgrades and live migrations. MySQL replication is built on the binary log and supports statement-based, row-based and mixed modes. Group Replication extends this into clusters with automatic primary election, the basis of InnoDB Cluster.
Both ecosystems have mature high-availability options. If built-in automatic primary election through InnoDB Cluster is a requirement, that is a concrete reason to lean toward MySQL. If selective, row-level replication or zero-surprise major-version upgrades matter more, PostgreSQL's logical replication is a core feature rather than an add-on.
Extensions, Licensing, and Release Support
PostgreSQL's extension framework loads extra capability directly into the server: PostGIS for geospatial data and pgvector for vector similarity search are the best-known examples. PostgreSQL is released under the PostgreSQL License, which the project describes as a liberal open-source license similar to BSD or MIT, and there is no commercial edition of PostgreSQL itself. MySQL exposes fewer in-core extension points and relies on pluggable storage engines, with InnoDB as the default.
MySQL is dual-licensed: Oracle offers the server and client libraries under GPLv2 or a commercial license. Oracle's guidance is that OEMs, ISVs and VARs that embed MySQL in distributed software, and do not want to release their own source under the GPL, should buy the commercial license. Oracle is the vendor of record for MySQL and controls its licensing. MariaDB is a community fork of MySQL that works as a drop-in replacement for it.
Plan around the support windows. As of 22 November 2026, PostgreSQL 19 is current and versions 19, 18, 17, 16 and 15 are supported. Each major version gets five years of support: PostgreSQL 14 reached end of life on 12 November 2026, and 15 follows on 11 November 2027. MySQL ships LTS and Innovation tracks with very different windows. LTS releases such as 8.4 and 9.7 get five years of Premier Support and three years of Extended Support, so pick an LTS release for long-lived systems.
Managed Offerings, Migration, and Coexistence
Every major cloud offers both engines as managed services: Amazon RDS and Aurora, Google Cloud SQL (which runs MySQL, PostgreSQL and SQL Server), and Azure Database. DigitalOcean also offers both, with high availability, automated failover and daily backups with point-in-time recovery. Check each provider's current documentation for tiers and pricing before committing.
Read the compatibility notes of any MySQL-compatible platform too. PlanetScale runs MySQL on Vitess, and Vitess restricts some MySQL features; its compatibility documentation lists stored procedures as unsupported.
Moving between the engines is real work, not a dump-and-load. Expect to handle these differences:
- PostgreSQL does not speak the MySQL protocol, so client drivers and connection settings change.
- String comparisons are case sensitive by default in PostgreSQL, which can change query results.
- Upserts use
ON CONFLICTinstead ofON DUPLICATE KEY UPDATE. - Data types, stored procedure languages and JSON handling need a schema conversion step first.
The two engines can also coexist: PostgreSQL runs alongside MySQL or MariaDB on the same server, so the engine can be chosen per application. That makes a gradual, service-by-service migration practical.
Common questions
Is PostgreSQL always the better choice for a new project?
No. PostgreSQL tends to win for complex queries, strict data integrity and specialized extensions. MySQL remains a solid choice when the framework or team already runs on it, when you want InnoDB Cluster, or when you want an Oracle-backed commercial license.
Is MySQL free to use in a commercial product?
MySQL is available under GPLv2, so it is free to run, but the terms depend on how you distribute it. Oracle advises that OEMs, ISVs and VARs that embed MySQL in distributed software and do not want to release their own source under the GPL should buy the commercial license.
Which database handles JSON better?
Both support JSON natively. PostgreSQL's jsonb supports GIN indexes for containment and key-existence lookups. MySQL indexes JSON through generated columns over specific paths, so documents queried on many different keys are easier to serve with PostgreSQL.
Which PostgreSQL versions are supported right now?
PostgreSQL 19, released on 19 November 2026, is current, and versions 19, 18, 17, 16 and 15 are supported. Version 14 reached end of life on 12 November 2026, and 15 reaches it on 11 November 2027.
Can I run PostgreSQL and MySQL side by side?
Yes. PostgreSQL runs next to MySQL or MariaDB on the same server, and you can choose the engine per application. This is useful during a migration, though you still need to convert schemas, upserts and case-sensitivity assumptions.
Sources
About this page
Last reviewed November 23, 2026 by the Nine Bits editors. Read our editorial policy or report an error.