Target Audience

This article assumes you have at least a passing familiarity with databases and some of the terminology around their features.

Introduction

Databases back every application, and there are many choices. MySQL has long been a popular open source choice; however, MariaDB and Percona are two major code forks that can replace MySQL with enhanced features. This article offers a broad comparison of the three.

Illustration by Walker Cahall Illustration by Walker Cahall

MySQL

MySQL Logo

Image: MySQL / Licensed under CC BY-SA 3.0

MySQL is a widely known, very popular open source relational database management system (often abbreviated RDBMS). It was developed as a high-availability, reliable database for web-based applications in the 1990s. Although open source, it is owned by Oracle, who offers it as a free community edition under the GPL (GNU General Public License) and as a commercially licensed version. The Oracle version of MySQL is a common installation on many hosts, a part of the classic LAMP and WAMP stacks, and the default database for WordPress.

Its strength lies in its longevity. The code base is very stable and reliable for the kind of web applications it was designed to support. There is a large community of MySQL users and administrators, and, as a result, a large collection of information published for MySQL, both on the web and in print.

Its weaknesses, in comparison to the other two databases, lie in its governance. Many in the open source community consider Oracle a blocking force to the open source nature of the original project. Also, because of the dual licensing model, certain applications require a commercial license.

MySQL vs MariaDB/Percona

When MySQL was acquired by Sun and then Oracle, groups left to start their own forks of the MySQL code. That brings us to MariaDB and Percona. Both are built to be drop-in replacements of MySQL. Applications that work with MySQL should also work with either of these forks. Despite being competitors, each fork draws from the open source code of the other. For example, MariaDB offers the XtraDB engine from Percona. Percona has picked up some of the optimizations and thread pool improvements from MariaDB. Both have improved over the base MySQL, including fixing subqueries.

MariaDB

MariaDB Logo
Image: MariaDB / Licensed under CC BY-SA 3.0

The MariaDB fork leans toward expanding the breadth of MySQL’s capabilities and is less conservative about adding new features than Percona. MariaDB has pushed toward making advances with the query optimizer. It’s a potentially better choice if you cannot determine what kind of queries your project needs regularly. Some other features that distinguish MariaDB include the following:

  • MariaDB includes a larger array of storage engines than either MySQL base or Percona, including now a NoSQL option with Cassandra. It also includes Percona’s XtraDB as an option.
  • As of version 10.1, MariaDB offers on-disk database encryption.
  • MariaDB offers scalability features including multi-source replication, allowing a single server to replicate from several sources.
  • The interaction of the Global Transaction IDs between MariaDB and MySQL might require careful implementation if you plan to have complex replication schema bridging MySQL flavors. For example, it is possible to replicate from MySQL 5.6 into MariaDB 10.X, but not the reverse.

Overall MariaDB is a mature future-looking branch of MySQL that aims to offer new features and advancements for the database. It is appropriate for large multi-server VPS hosting applications, especially those with changing query patterns that can take advantage of MariaDB’s optimizer.

Percona Server

Percona has concentrated on very demanding applications with their own high-performance alternative to the InnoDB storage engine called XtraDB, including instrumentation tools to tune it. Their features tend toward performance, availability, and scalability improvements for the largest databases with the highest throughput. On their website, Percona claims to be closer to the base MySQL code from a compatibility point of view and more conservative than MariaDB. Other features favoring Percona include the following:

  • In their push for performance, Percona offers more counters and diagnostics to measure performance and to tune the database.
  • Percona has scalability enhancements for large databases, including some features in their free Server product that are only available in the Enterprise level of MySQL.
  • Percona also has extra tools beyond the DB engine including an XtraDB Cluster and an XtraBackup utility.

Like MariaDB, Percona is a mature open-source branch of MySQL. Their focus is more on the performance of the biggest and the most demanding databases with the tools to achieve and maintain that performance.

So Which Is Actually Better?

As in most things in tech, the answer is “it depends.” Much of the debate seems to be a two-stage argument rather than a three-way battle. The first stage is MySQL versus one of its replacements. You have to decide if you even need a change. The forks enhance the base MySQL with performance improvements and with additional features and tools. Performance becomes a bigger deal the larger your database is, so small databases are less likely to see much of that benefit in the forks. But there could be other reasons to head for a replacement, such as licensing or data flexibility. If you decide for a drop-in, then the discussion turns to which one.

It would be too easy to look at even the comparison above and say that MariaDB doesn’t care about performance or that the optimizer in Percona is subpar. That is not at all true. Both forks excel at the basic database level. They differentiate more as you reach the edge of the envelope.

Then what is more important? If it’s the ability to store flexible types of data across a number of different sources, check out MariaDB first. If you have a larger database that still requires snappy performance, start your search with Percona. Even still, don’t ignore the other branch fully. Some of their tools, because of the common MySQL root, can work with either branch and could be just the solution you need.

If you have outgrown MySQL and want to reach into one of the forks, but you aren’t at the bleeding edge of size or flexibility, then the decision seems to be one of taste. Which company offers you the services or tools that you would use anyway?

Still not sure, or want to do more in-depth reading? Take a look at some of following comparisons the MariaDB and Percona folks have put together.