MariaDB vs MySQL vs PostgreSQL





PostgreSQL vs MySQL vs MariaDB - Help me Decide

PostgreSQL & MySQL are the two most popular open-source databases today.

The less popular MariaDB is a MySQL fork that happened after the acquisition of Sun Microsystems by Oracle on January 27, 2010.

Here's a graph representing the popularity of these 3 databases:

DB Ranking


PostgreSQL & MariaDB have been gaining ground recently, while MySQL is slowly declining. But that's not enough to make a decision.

So which one should you choose?

Let's look at this from different angles.


By running some benchmarks you can get a rough idea of how these databases compare to each other in terms of performance.

For this article, we going to use the HammerDB benchmarking tool.

This tool implements a standardized performance test called TPC-C.

Here's the description:

"TPC-C involves a mix of five concurrent transactions of different types and complexity. The database is comprised of nine types of tables with a wide range of record and population sizes."

Here's the setup:

  • Ubuntu 18.04
  • 1 GB RAM
  • 1 CPU
  • MySQL 5.7.23
  • MariaDB 10.1
  • PostgreSQL 10.5
  • Default settings

We ran the tests for 5 minutes for each database.

Here are the results:

  • PostgreSQL 18534 TPM, 7972 NOPM
  • MySQL 14051 TPM, 4659 NOPM
  • MariaDB 21441 TPM, 7172 NOPM

The meaning of these two values (TMP & NOPM) is described like this:

"TPM values cannot be compared between different database types. The NOPM value is based on a metric captured from within the test schema itself. As such NOPM (New Orders Per Minute) is a performance metric independent of any particular database implementation and is the recommended primary metric to use."

Performance Chart

Like any benchmark the results depend on the specific scenario the tests are run in.

This particular benchmark tries to reproduce the workload of any industry that must manage, sell or distribute a product or service.

Knowing that, we can conclude that both PostgreSQL & MariaDB are faster than MySQL in this particular scenario, with PostgreSQL coming on top of the raw performance game.


These 3 databases support all the basic SQL operations you would expect.

But when it comes to more advanced features there is a lot of variability between them.

For example, PostgreSQL supports materialized views, while MySQL doesn't.

Here's a feature comparison table:

| Feature | PostgreSQL | MySQL | MariaDB | | :------------------- | :------------- | :------------- | :------------- | | Materialized Views | ✓ | ✖ | ✖ | | Partial Indexes | ✓ | ✖ | ✖ | | Array Data Type | ✓ | ✖ | ✖ | | JSON Data Type | ✓ | ✓ | ✓ | | CHECK constraints | ✓ | ✖ | ✓ (from version 10.2.1) | | Replication | ✓ | ✓ | ✓ | | Full-Text Search | ✓ | ✓ | ✓ | | UPSERT | ✓ | ✓ | ✓ | | Common Table Expressions | ✓ | ✓ | ✓ | | Sequences | ✓ | ✖ | ✓ |

Looking at this table we can conclude that PostgreSQL has the most features implemented.

Besides these features, you can find some behavior differences.

For example, this query:

select 1000/0;

Returns NULL in MySQL, while PostgreSQL & MariaDB (since version 10.2.4) return a division by zero error.

This can be changed with SQL modes in MySQL.

Administration & Monitoring Tools

Because databases are critical software components there are dozens of tools available for administration, monitoring & troubleshooting.

Starting with the command-line applications:

  • mysql (MySQL, MariaDB)
  • psql (PostgreSQL)

These are great for basic administration tasks.


Because they come built-in with their respective servers so they are always available. There is nothing extra to install.

They both have a command history available, so you can re-run previously executed queries & commands.

And they have a set of bult-in commands that can facilitate interacting with the database.

For example, psql has the \d command to list all your databases, and mysql has the status command to get information like the server version & uptime.

Official graphical tools are also available.

They are:

Here's a screenshot from pgAdmin4:


And for MySQL Workbench:

MySQL Workbench

Now we move onto more specialized tools like pghero (PostgreSQL).

PgHero is "a performance dashboard for Postgres".

Here's a screenshot:


For MySQL, and MariaDB, you can use MySQL Tuner. This is a Perl script that will analyze your configuration file & database statistics to produce configuration recommendations.

Here's a screenshot:


There are also log-parsing tools to help you find slow queries.

Here's pt-query-digest for MySQL, a tool for analyzing your logs & running queries to find the slowest queries so you can optimize them.

As you can see in this screen, it's also a command-line tool:


And here is pgBadger for PostgreSQL:


pgBadger is like pt-query-digest, but it will analyze PostgreSQL logs & slowest queries.

It looks like PostgreSQL has more graphical tools available, so if you are more comfortable using tools with graphical frontends, instead of command-line applications, then you may want to keep this in mind when making your decision.


You can install plugins & extensions if you need extra features for your database.

Extending MySQL & MariaDB is mostly done in the form of UDFs (User-Defined Functions), which are small plugins written in C.

However, it doesn't seem to be a very popular feature, so it's hard to find any useful UDF extensions.

PostgreSQL has some helpful extensions:

  • PostGIS adds spatial search capabilities for geographic information systems (GIS)
  • HStore allows you to use key-value storage without having to install a specialized database
  • Multicorn allows you to query other sources of data (like Redis, Amazon S3, or even Twitter!) as if they were real tables

If you need any of these extensions then PostgreSQL might be a great choice for you.

Final Considerations

To make a good decision you should consider what your needs are.

  • Is your application going to do a lot of work with geographic information? Then the PostGIS extension would be of great help.
  • Could your application benefit from specific features that each database supports, like materialized views or partial indexes? Then choose that database.
  • Do you need more hosting & support options? Then MySQL or MariaDB may be a better fit.

We hope you found this comparison useful!

What is MariaDB?

Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry. MariaDB is designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

What is MySQL?

The MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.

What is PostgreSQL?

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions.

Want advice about which of these to choose?Ask the StackShare community!

Why do developers choose MariaDB?
Why do developers choose MySQL?
Why do developers choose PostgreSQL?
What are the cons of using MariaDB?
What are the cons of using MySQL?
What are the cons of using PostgreSQL?
Be the first to leave a con
What companies use MariaDB?
What companies use MySQL?
What companies use PostgreSQL?
What are some alternatives to MariaDB, MySQL, and PostgreSQL?
Oracle Database is an RDBMS. An RDBMS that implements object-oriented features such as user-defined types, inheritance, and polymorphism is called an object-relational database management system (ORDBMS). Oracle Database has extended the relational model to an object-relational model, making it possible to store complex business models in a relational database.
MongoDB stores data in JSON-like documents that can vary in structure, offering a dynamic, flexible schema. MongoDB was also designed for high availability and scalability, with built-in replication and auto-sharding.
Microsoft SQL Server
Microsoft® SQL Server is a database management and analysis system for e-commerce, line-of-business, and data warehousing solutions.
SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.
Apache Aurora
Apache Aurora is a service scheduler that runs on top of Mesos, enabling you to run long-running services that take advantage of Mesos' scalability, fault-tolerance, and resource isolation.
See all alternatives
What tools integrate with MariaDB?
What tools integrate with MySQL?
What tools integrate with PostgreSQL?
Decisions about MariaDB, MySQL, and PostgreSQL
Jake Stein
Jake Stein
CEO at Stitch · | 15 upvotes · 21.6K views

The majority of our Clojure microservices are simple web services that wrap a transactional database with CRUD operations and a little bit of business logic. We use both MySQL and PostgreSQL for transactional data persistence, having transitioned from the former to the latter for newer services to take advantage of the new features coming out of the Postgres community.

Most of our Clojure best practices can be summed up by the phrase "keep it simple." We avoid more complex web frameworks in favor of using the Ring library to build web service routes, and we prefer sending SQL directly to the JDBC library rather than using a complicated ORM or SQL DSL.

See more
Anton Sidelnikov
Anton Sidelnikov
Backend Developer at Beamery · | 5 upvotes · 8.7K views

In my opinion PostgreSQL is totally over MongoDB - not only works with structured data & SQL & strict types, but also has excellent support for unstructured data as separate data type (you can store arbitrary JSONs - and they may be also queryable, depending on one of format's you may choose). Both writes & reads are much faster, then in Mongo. So you can get best on Document NoSQL & SQL in single database..

Formal downside of PostgreSQL is clustering scalability. There's not simple way to build distributed a cluster. However, two points:

1) You will need much more time before you need to actually scale due to PG's efficiency. And if you follow database-per-service pattern, maybe you won't need ever, cause dealing few billion records on single machine is an option for PG.

2) When you need to - you do it in a way you need, including as a part of app's logic (e.g. sharding by key, or PG-based clustering solution with strict model), scalability will be very transparent, much more obvious than Mongo's "cluster just works (but then fails)" replication.

See more
Joshua Dean Küpper
Joshua Dean Küpper
CEO at Scrayos UG (haftungsbeschränkt) · | 4 upvotes · 11.5K views
atScrayos UG (haftungsbeschränkt)

We primarily use MariaDB but use PostgreSQL as a part of GitLab , Sentry and @Nextcloud , which (initially) forced us to use it anyways. While this isn't much of a decision – because we didn't have one (ha ha) – we learned to love the perks and advantages of PostgreSQL anyways. PostgreSQLs extension system makes it even more flexible than a lot of the other SQL-based DBs (that only offer stored procedures) and the additional JOIN options, the enhanced role management and the different authentication options came in really handy, when doing manual maintenance on the databases.

See more
Interest over time
Reviews of MariaDB, MySQL, and PostgreSQL
Review ofMariaDBMariaDB

MySQL was founded by Allan Larsson, Michael Widenius and David Axmark in the year 1995, 19 years ago. It was released under the name of co-founder Michael Widenius daughter, ‘My‘. This project was released under GNU General Public License as well as under certain Proprietary License. MySQL was owned by MySQL AB firm until it went into the hands of Oracle Corporation. It is written in Programming Language – C and C++ and is available for Windows, Linux, Solaris, MacOS and FreeBSD.

In the year 2009, Michael Widenius started working on MarisDB as a fork of MySQL. In the year 2012 the bricks of nonprofit MariaDB Foundation was laid. It was named after the founder’s daughter Maria.

MariaDB is a fork of MySQL Relational Database Management System which again is released under GNU General Public License. It is written in Programming Language – C, C++, Perl and Bash and is available for Systems Linux, Windows, Solaris, MacOS and FreeBSD.

How developers use MariaDB, MySQL, and PostgreSQL
Avatar of AngeloR
AngeloR uses PostgreSQLPostgreSQL

We use postgresql for the merge between sql/nosql. A lot of our data is unstructured JSON, or JSON that is currently in flux due to some MVP/interation processes that are going on. PostgreSQL gives the capability to do this.

At the moment PostgreSQL on amazon is only at 9.5 which is one minor version down from support for document fragment updates which is something that we are waiting for. However, that may be some ways away.

Other than that, we are using PostgreSQL as our main SQL store as a replacement for all the MSSQL databases that we have. Not only does it have great support through RDS (small ops team), but it also has some great ways for us to migrate off RDS to managed EC2 instances down the line if we need to.

Avatar of Cloudcraft
Cloudcraft uses PostgreSQLPostgreSQL

PostgreSQL combines the best aspects of traditional SQL databases such as reliability, consistent performance, transactions, querying power, etc. with the flexibility of schemaless noSQL systems that are all the rage these days. Through the powerful JSON column types and indexes, you can now have your cake and eat it too! PostgreSQL may seem a bit arcane and old fashioned at first, but the developers have clearly shown that they understand databases and the storage trends better than almost anyone else. It definitely deserves to be part of everyone's toolbox; when you find yourself needing rock solid performance, operational simplicity and reliability, reach for PostgresQL.

Avatar of Brandon Adams
Brandon Adams uses PostgreSQLPostgreSQL

Relational data stores solve a lot of problems reasonably well. Postgres has some data types that are really handy such as spatial, json, and a plethora of useful dates and integers. It has good availability of indexing solutions, and is well-supported for both custom modifications as well as hosting options (I like Amazon's Postgres for RDS). I use HoneySQL for Clojure as a composable AST that translates reliably to SQL. I typically use JDBC on Clojure, usually via org.clojure/java.jdbc.

Avatar of Rajeshkumar T
Rajeshkumar T uses MySQLMySQL
  • We are used MySQL database to build the Online Food Ordering System

    • Its best support normalization and all joins ( Restaurant details & Ordering, customer management, food menu, order transaction & food delivery).
    • Best for performance and structured the data.
    • Its help to stored the instant updates received from food delivery app ( update the real-time driver GPS location).
Avatar of Srinivas Adireddi
Srinivas Adireddi uses MySQLMySQL

1.It's very popular. Heared about it in Database class 2. The most comprehensive set of advanced features, management tools and technical support to achieve the highest levels of MySQL scalability, security, reliability, and uptime. 3. MySQL is an open-source relational database management system. Its name is a combination of "My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured Query Language.

Avatar of ShadowICT
ShadowICT uses MySQLMySQL

We use MySQL and variants thereof to store the data for our projects such as the community. MySQL being a well established product means that support is available whenever it is required along with an extensive list of support articles all over the web for diagnosing issues. Variants are also used where needed when, for example, better performance is needed.

Avatar of ReviewTrackers
ReviewTrackers uses PostgreSQLPostgreSQL

PostgreSQL is responsible for nearly all data storage, validation and integrity. We leverage constraints, functions and custom extensions to ensure we have only one source of truth for our data access rules and that those rules live as close to the data as possible. Call us crazy, but ORMs only lead to ruin and despair.

Avatar of shridhardalavi
shridhardalavi uses MySQLMySQL

MySQL is a freely available open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). SQL is the most popular language for adding, accessing and managing content in a database. It is most noted for its quick processing, proven reliability, ease and flexibility of use.

Avatar of Jeff Flynn
Jeff Flynn uses PostgreSQLPostgreSQL

Tried MongoDB - early euphoria - later dread. Tried MySQL - not bad at all. Found PostgreSQL - will never go back. So much support for this it should be your first choice. Simple local (free) installation, and one-click setup in Heroku - lots of options in terms of pricing/performance combinations.

Avatar of John Galbraith
John Galbraith uses MySQLMySQL

I am not using this DB for blog posts or data stored on the site. I am using to track IP addresses and fully qualified domain names of attacker machines that either posted spam on my website, pig flooded me, or had more that a certain number of failed SSH attempts.

Avatar of Scrayos UG (haftungsbeschränkt)
Scrayos UG (haftungsbeschränkt) uses MariaDBMariaDB

Aside from Redis, we use MariaDB to store long-term information like user-data and big-data like regeneration-information for our open-world servers. We extensively use the relational aspects of MariaDB in joins, nested queries and unions.

Avatar of Seungkwon Park
Seungkwon Park uses MariaDBMariaDB

mysql보다 mariaDB가 join면에서 우수하다는 문서를 읽었습니다. 이 부분은 저의 블로그에서도 다뤘고 저의 word press 블로그는 mysql 대신 mariaDB 를 사용합니다.

특히 limit 기능이 pagenation 처리를 할 때 너무 직관적이고 편해서 mariaDB, mysql을 사랑합니다.

Avatar of Ana Phi Sancho
Ana Phi Sancho uses MariaDBMariaDB

Introduced in computer science course.managing relational database management systems, database analytics, and for data processing

Avatar of nrise
nrise uses MariaDBMariaDB

수 백만개가 넘는 태그 키워드의 자동완성을 위해서 별도의 데이터베이스를 구축하였습니다. MariaDB 는 MySQL 을 포크한 프로젝트입니다. MySQL 과의 강력한 호환성을 지니며, 큰 튜닝 없이 강력한 성능을 보장합니다.

Avatar of Dolls Kill
Dolls Kill uses MariaDBMariaDB

MariaDB has allowed us to easily scale out our DB cluster. Also has better replication tools than MySQL

How much does MariaDB cost?
How much does MySQL cost?
How much does PostgreSQL cost?
Pricing unavailable
Pricing unavailable
Pricing unavailable