Search iThub

Search tools, categories and collections. Type at least two characters.

Explore all tools
↑ ↓ to explore resultsEnter to open · Esc to close

MySQL vs PostgreSQL

Key differences, specifications and fit guidance for MySQL and PostgreSQL, compiled from official documentation and the iThub profiles.

MySQL is a relational database first released in 1995, developed by Oracle and offered under GPL version 2 or a proprietary license.

Pricing
Open source
Deployment
Self-hosting supported
Source
Open-source edition
Platforms
Windows, macOS, Linux

PostgreSQL is a free, open source object-relational database that extends SQL, with JSON/JSONB support, MVCC and many index types.

Pricing
Open source · Free edition or plan
Deployment
Self-hosting supported
Source
Open-source edition
Platforms
Windows, macOS, Linux
Written by
iThub editorial team
Updated
Sources checked
Official sources
8
Views
0
On this page
  1. Quick verdict
  2. Key differences
  3. Specifications
  4. What are MySQL and PostgreSQL?
  5. How to evaluate
  6. FAQ
  7. Sources

Quick verdict

Choose PostgreSQL if you want a permissively licensed, extensible object-relational database with JSONB indexing, many index types and every SQL standard isolation level; choose MySQL if you build on the LAMP stack or common web applications and want an Oracle-backed engine with an optional proprietary licence. Both are free, self-hostable and ACID compliant with InnoDB or PostgreSQL's MVCC engine. The deciding factors are licensing, where PostgreSQL's BSD-style licence differs from MySQL's GPLv2 or commercial dual licence, and how much you need extensions, advanced indexing and document data.

Choose MySQL if

Shortlist MySQL when your applications run on the LAMP stack or tools such as WordPress or Drupal, and you want the option of a commercial licence and Enterprise support from Oracle.

Choose PostgreSQL if

Shortlist PostgreSQL when you need a permissive licence, advanced index types, JSONB indexing, strict isolation levels or extensions such as PostGIS and foreign data wrappers.

Key differences

Key differences between MySQL vs PostgreSQL
AspectMySQLPostgreSQL
Licence modelMySQL server and client libraries are dual licensed: GPL version 2 for the Community release, or a proprietary licence from Oracle.PostgreSQL uses the PostgreSQL License, a liberal open source licence similar to the BSD or MIT licences, and the project commits to keeping it free and open source.
Governance and ownershipMySQL is developed by the MySQL team at Oracle; in 2010 co-founder Michael Widenius forked it to create MariaDB.PostgreSQL is developed by the PostgreSQL Global Development Group, a community project that traces back to the POSTGRES project at Berkeley in 1986.
Editions and supportMySQL comes as the open source Community Server and the proprietary Enterprise Server, which adds proprietary extensions installed as server plugins.PostgreSQL ships as a single free distribution; commercial support and hosting come from independent companies listed by the project.
Storage and concurrencyMySQL uses pluggable storage engines per table; the default InnoDB supports transactions and referential integrity, while some other engines lack full SQL standard behaviour.PostgreSQL uses one MVCC engine in which reads never block writes and writes never block reads, with every SQL standard isolation level including Serializable.
Indexing and document dataMySQL supports a native JSON data type defined by RFC 7159, and its default InnoDB engine handles transactional workloads with referential integrity constraints.PostgreSQL offers GiST, SP-GiST, GIN, BRIN, covering indexes and Bloom filters, plus JSON/JSONB, XML and Hstore types, and jsonb supports indexing.
Extensibility and languagesMySQL supports stored procedures in a procedural language that closely follows SQL/PSM, and Enterprise features install as server plugins.PostgreSQL lets you define data types and functions, write code in PL/pgSQL, Perl, Python or Tcl, add extensions such as PostGIS and query other databases through foreign data wrappers.
Replication and availabilityMySQL has built-in asynchronous replication, and Oracle offers a high availability setup based on Group Replication with MySQL Router and MySQL Shell.PostgreSQL includes asynchronous, synchronous and logical replication, point-in-time recovery and active standbys.
Ecosystem and standardsMySQL is part of the LAMP stack and is used by web applications such as Drupal, Joomla, phpBB and WordPress.PostgreSQL is extended by add-ons such as the PostGIS geospatial extender and conforms to at least 170 of 177 mandatory SQL:2023 Core features as of version 18.

More specifications

From the iThub profiles. “Not recorded” means the profile does not confirm it. Confirm prices and editions with each vendor.

MySQL vs PostgreSQL specifications
AttributeMySQLPostgreSQL
Starting priceSee vendor pricingFree edition or plan
APIYes ↗Yes
Founded19951996
HeadquartersAustin, Texas, USAOpen Source Project
GitHub stars12.5K ↗22.7K ↗
DocumentationOfficial docs ↗Official docs ↗

What are MySQL and PostgreSQL?

MySQL

MySQL is a free and open-source relational database management system. It was first released on 23 May 1995 by MySQL AB, a Swedish company that was later bought by Sun Microsystems, now part of Oracle Corporation. Oracle is the current developer. The server software and client libraries are dual-licensed, offered under GPL version 2 or under a proprietary license.

MySQL runs on Linux, Solaris, macOS, Windows and FreeBSD, among many other platforms. It is a component of the LAMP web application stack, which pairs it with Linux, Apache and PHP, Perl or Python. Applications usually use MySQL through other programs, though stand-alone clients also let users run SQL against a database directly.

PostgreSQL

PostgreSQL is an open source object-relational database system that uses and extends the SQL language. Its origins date back to 1986 and the POSTGRES project at the University of California at Berkeley, and it has nearly 40 years of active development on the core platform. It is free and open source, and it runs on all major operating systems.

PostgreSQL has been ACID-compliant since 2001. Its feature list includes multi-version concurrency control (MVCC), table partitioning and every transaction isolation level defined in the SQL standard, including Serializable. Indexing options go beyond B-tree to GiST, SP-GiST, GIN, BRIN, covering indexes and Bloom filters.

How to evaluate MySQL and PostgreSQL

PostgreSQL and MySQL are both free, self-hostable relational databases, but they differ in governance, licence and engine design. PostgreSQL is a community project under a BSD-style licence, with one MVCC engine, many index types and JSONB. MySQL is developed by Oracle, dual licensed under GPLv2 or a proprietary licence, and uses pluggable storage engines with InnoDB as the default.

Before choosing, list the applications and frameworks that will connect to the database and the data types they need. Confirm how you will distribute any product that embeds the database, decide who supplies support, and agree on the replication, backup and upgrade targets your operations team must meet.

Criteria to verify

  • Licence fit for distributed products
  • JSON and index needs of queries
  • Replication and failover requirements
  • Application and framework compatibility
  • Support provider and response terms

Proof-of-concept plan

Load the same production-sized dataset into PostgreSQL and MySQL on identical hardware. Run your ten heaviest queries, a JSON lookup workload and a concurrent read and write test, set up one replica on each, then perform a failover and a point-in-time restore. Record query times, lock waits, setup steps and recovery time.

Advertisements

Frequently asked questions

Is PostgreSQL or MySQL free to use?

Both have free open source releases. PostgreSQL is released under the PostgreSQL License, a liberal licence similar to BSD or MIT. MySQL Community is released under GPL version 2, and Oracle also offers MySQL under a proprietary licence and sells the Enterprise Server with proprietary extensions and paid support.

What is the main difference between PostgreSQL and MySQL?

The main difference is design and licensing. PostgreSQL is a community-run object-relational database with one MVCC engine, many index types, JSONB and a permissive BSD-style licence. MySQL is an Oracle-developed relational database with pluggable storage engines, InnoDB by default, and dual licensing under GPL version 2 or a proprietary licence.

Which handles JSON better, PostgreSQL or MySQL?

Both store JSON. PostgreSQL offers json and jsonb types; jsonb is stored in a decomposed binary format that is faster to process and supports indexing, including GIN indexes for searching keys and key/value pairs. MySQL supports a native JSON data type defined by RFC 7159. Test your own queries on both, because the indexing options differ.

Does MySQL have a commercial licence?

Yes. According to Wikipedia, the MySQL server and client libraries are offered under GPL version 2 or under a proprietary licence. This matters if you embed MySQL in a product you distribute. PostgreSQL has no such split: its PostgreSQL License is a liberal open source licence similar to the BSD or MIT licences.

Who supports PostgreSQL and MySQL?

PostgreSQL support comes from the community and from many commercial companies offering services and hosting, since no single vendor owns the project. MySQL is developed by the MySQL team at Oracle, which sells paid support through MySQL Enterprise products, while free help is available in community forums and third parties also offer services.

What is MariaDB and how does it relate to MySQL?

MariaDB is a fork of MySQL. In 2010, when Oracle acquired Sun Microsystems, MySQL co-founder Michael Widenius forked the open source MySQL project to create MariaDB. Teams evaluating MySQL against PostgreSQL sometimes add MariaDB to the shortlist, but it is a separate project with its own releases.

Sources

Facts on this page come from these official pages, checked on , and from the iThub profiles. Vendors change plans and features: confirm with them before buying.