MySQL vs PostgreSQL
MySQL and PostgreSQL are two of the most widely used open-source relational databases. This comparison sets them side by side on the six aspects that most often decide an enterprise's choice, and says which fits which workload.
Both are free and mature. PostgreSQL offers more data types, schema changes that can be rolled back and a large set of extensions. MySQL has a simpler start, long-established replication, and is the database many web applications, including WordPress, are built for.
Prices and other facts are as of October 29, 2026. Vendors change prices; confirm them on the vendor’s own pricing page. Independent analysis: neither project nor any vendor named here paid for or reviewed this page.
Who stands behind each
PostgreSQL began as a research project at the University of California, Berkeley. A community, the PostgreSQL Global Development Group, develops it, and no company owns it.
Oracle has owned MySQL since it acquired Sun Microsystems in January 2010. Oracle licenses it under the GPL and sells a commercial license. MariaDB, made by MySQL's original developers, began as a fork of it.
Six differences that decide it
Compared as of PostgreSQL 18 and MySQL 9.7 LTS.
| Aspect | MySQL | PostgreSQL | What it means |
|---|---|---|---|
| License and ownership | GPLv2, or a commercial license from Oracle for software that embeds MySQL without GPL terms. | The PostgreSQL License, a short permissive license. Developed by a community. | Shipping a product with the database inside is simpler with PostgreSQL. |
| Data types and SQL | A JSON type, common table expressions and window functions, with a smaller set of built-in types. | Arrays, ranges, binary JSON (jsonb) with indexes, and user-defined types. | PostgreSQL holds varied or changing data with less work. |
| Transactions and schema changes | A schema change commits the open transaction and cannot be rolled back. InnoDB's default isolation is repeatable read. | Schema changes can run inside a transaction and roll back. The default isolation is read committed. | A failed migration is easier to undo on PostgreSQL. |
| Extensions | Pluggable storage engines, with InnoDB as the default. | Extensions add features in place: PostGIS for geospatial data, pgvector for vector search, Citus for distributed tables. | PostgreSQL can take on work that would otherwise need a second database. |
| Replication and scale-out | Binary-log replication and Group Replication are built in. Vitess shards MySQL across servers. | Streaming and logical replication are built in. Citus distributes tables across servers. | Both scale out, each with its own sharding software. |
| Running it | Fewer settings to tune at the start. Offered as a managed service by the major clouds. | Needs routine vacuuming, which autovacuum handles by default. Offered as a managed service by the major clouds. | On a managed service the operational gap is small. |
In brief
Choose MySQL when
- your software is built for it, such as WordPress
- the workload is a web application with straightforward queries
- your team already runs MySQL replication well
Choose PostgreSQL when
- the data model is complex or will change often
- you need JSON, geospatial or vector search beside relational data
- a permissive license matters to your legal team
By situation
A new SaaS product
PostgreSQL. The data model will change, and schema changes that roll back make each release safer.
A site on WordPress
MySQL or MariaDB. WordPress requires one of the two.
AI search over your own data
PostgreSQL with pgvector keeps embeddings beside the rows they describe, without a second database.
A large MySQL estate that works
Stay, unless a specific need forces a move. The application changes cost more than the database switch.
Which is faster?
That depends on the workload, the schema and the tuning, not the product name. Published benchmarks rarely match a real application. Run your own heaviest queries on both before deciding on speed.
Moving from one to the other
Schema and data move with tools such as pgloader or a cloud provider's migration service. Most of the work is in the application: SQL dialect differences, auto-increment against identity columns, case sensitivity and stored procedures. Plan a full test cycle.
Common questions
Is PostgreSQL free for commercial use?
Yes. The PostgreSQL License allows use, copying, modification and distribution for any purpose without a fee.
Does Oracle own MySQL?
Yes, since it acquired Sun Microsystems in January 2010.
Is MariaDB the same as MySQL?
It began as a fork of MySQL by its original developers. The two have diverged since, so check compatibility before switching.
Sources
- PostgreSQL License
- A brief history of PostgreSQL
- MySQL commercial and GPL licensing
- Sun Microsystems 10-Q: acquisition of MySQL AB (2008)
- Oracle 8-K: Oracle completes acquisition of Sun (January 2010)
- About MariaDB
- MySQL: statements that cause an implicit commit
- Transactional DDL in PostgreSQL
- PostgreSQL transaction isolation
- InnoDB transaction isolation levels
- PostgreSQL routine vacuuming
- PostgreSQL logical replication
- MySQL Group Replication
- Vitess
- Citus
- PostGIS
- pgvector
- WordPress requirements
- PostgreSQL releases
- MySQL July 2026 releases