Mariadb Vs Mysql: Daniel Bartholomew Monty Program, Ab Sep 2012
Mariadb Vs Mysql: Daniel Bartholomew Monty Program, Ab Sep 2012
Mariadb Vs Mysql: Daniel Bartholomew Monty Program, Ab Sep 2012
Daniel Bartholomew
Monty Program, Ab
Sep 2012
Contents
Introduction 2
Conclusion 5
Notes 6
1
MariaDB vs. MySQL 2
Introduction
The purpose of this document is to compare MariaDB and MySQL
R
, noting their
similarities and their differences. Before doing so it will be helpful — to those who
may not be familiar with one or the other — to describe each one in general terms.
Both are what is known as a Relational Database Management System, or RDBMS.1
The most well known RDBMS is probably Oracle Corporation’s Oracle Database.
What is MySQL?
MySQL grew out of a need in the early 1990s for a fast, flexible database for use
in web-based applications. No suitable existing databases were found, so Michael
“Monty” Widenius developed one. He called it “MySQL” after his daughter, My, and
SQL, which stands for Structured Query Language. SQL is a programing language
used to interact with MySQL and many other databases.
When people think of an easy-to-use, reliable, open-source database, the first one
they often think of is MySQL. This popular database has been around for many years,
is stable and reliable, and is used by a many companies, both large and small, in a wide
range of industries.
MySQL was developed for many years by the company MySQL Ab. The company
was acquired in 2008 by Sun Microsystems. Sun was, in turn, acquired by Oracle
Corporation in 2009.
MySQL is released under two main “editions”. There is an open source, commu-
nity edition, which uses the GPL license, version 2.2 And there is a closed source,
enterprise edition.
What is MariaDB
MariaDB is an enhanced, drop-in, binary compatible replacement for MySQL created
by several of the former core developers of MySQL including Monty, who left soon af-
ter the Sun acquisition because he was dissatisfied with the quality of MySQL releases
after the merger and the slow rate of improvement.
When using MariaDB, users may notice that the SQL language and commands are
the same between MySQL and MariaDB. The configuration files are also the same,
with a very few new, easy to learn, MariaDB-specific parts.
Going deeper, things like the ports and sockets, the client APIs and protocols
MariaDB uses are all the same as MySQL. All MySQL connectors, those bits of code
which allow languages like Java, C, PHP, .Net, Perl, Python, and Ruby to talk directly
to a MySQL database, all work unchanged with MariaDB. All client programs that can
talk to MySQL databases can also talk to MariaDB databases without any changes.
Even the “on disk” format of the databases is the same. MySQL can open a
database created with MariaDB just like MariaDB can open one created with MySQL.
All told, an experienced MySQL user or database administrator (DBA) will be up
and running instantly with MariaDB on day one, and they will be able to learn and
start taking advantage of the differences with a minimal amount of learning. Someone
new to databases, or just to MySQL and MariaDB, will have no trouble utilizing the
many MySQL — and growing number of MariaDB — training and learning resources
available both online and off to get up and running with MariaDB.
With today’s high-performance database servers, having the highest precision of the
TIME, DATETIME, and TIMESTAMP datatypes, and their associated temporal functions,
be a single second was limiting. So another MariaDB improvement is the addition of
microsecond support.5
The developers have also introduced some NoSQL-style features to MariaDB. Han-
dlerSocket6 is one. It provides developers with fast, direct access to InnoDB tables by
skipping the SQL layer. Another is Dynamic Columns7 , which provides users with the
ability to have a different set of “virtual” columns for each row in a table.
Lastly, users who are coming to MariaDB or MySQL from other databases may
have heard horror stories about the horrible status of subqueries. For all practical pur-
poses, subqueries in MySQL are unusable. They were unusable in MariaDB until the
developers decided to tackle this old problem and take care of it once and for all. The
result is that in MariaDB, subqueries are actually usable and useful.8
Many other ease of use improvements are included in MariaDB which we don’t
have time to go into here.
Performance in MariaDB
Several enhancements found in MariaDB are performance related. MySQL has great
performance out of the box, but that does not mean it can’t be improved. One of the
major goals of the MariaDB developers is to continually improve the performance of
MariaDB.
One area the developers have focused on is the optimizer. The optimizer is the
engine that sits at the core of MySQL and MariaDB. Its job is to take the entered SQL
commands and turn them into instructions for the database.9 The improved optimizer
in MariaDB performs significantly faster than MySQL on complex workloads.10
Replication is another area of focus and the MariaDB developers have introduced
several enhancements in this area. One is “group commit for the binary log”11 , which
makes many setups which use replication and have many updates more than two times
faster.
Another new feature in MariaDB is Table Elimination12 This optimization is espe-
cially useful when using views to access highly normalized data. The basic idea is that
sometimes it is possible to resolve a query without even accessing some of the tables
that the query refers to. And since the query doesn’t need to access as many tables, it
completes faster.
Many other performance improvements are included in MariaDB which we don’t
have time to go into here.
• . . . more tests in the test suite. Dozens of new tests have been added to the
MariaDB vs. MySQL 5
MariaDB test suite, both to test newly found bugs, and to provide greater cover-
age of the MariaDB code.
• . . . fixes for test suite bugs. The MariaDB developers test the test suite, just like
they test other parts of MariaDB
• . . . testing builds with different configure options and on multiple operating sys-
tem and processor combinations, to get better feature testing.
• . . . the removal of invalid tests. For example: Don’t test feature “X” if that feature
is not in the build you are testing.
• . . . and much more.
The cumulative effect of the expanded and enhanced MariaDB test infrastructure
is that bugs are found earlier and fixed faster, and new features are thoroughly and
extensively tested long before they are released.
Conclusion
With MariaDB, you not only get everything good from MySQL, you also get extra
features, performance improvements, better testing, and fewer bugs. For a growing
number of individuals and companies the choice is clear: MariaDB is the future of
MySQL.
MariaDB vs. MySQL 6
Notes
1 More about RDMBSs is available on Wikipedia: http://en.wikipedia.org/wiki/RDBMS
2A copy of the GPLv2 license is available at: http://kb.askmonty.org/en/mariadb-license
3 User Statistics documentation: http://kb.askmonty.org/en/user-statistics
4 Progress Reporting documentation: http://kb.askmonty.org/en/progress-reporting
5 Microsecond documentation: http://kb.askmonty.org/en/microseconds-in-mariadb
6 HandlerSocket documentation: http://kb.askmonty.org/en/handlersocket
7 Dynamic Columns documentation: http://kb.askmonty.org/en/dynamic-columns
8 Subquery documentation: http://kb.askmonty.org/en/subquery-optimizations
9 A complete list of the optimizer enhancements and a comparison with MySQL is at http://kb.
askmonty.org/en/optimizer-feature-comparison-matrix.
10 A benchmark comparing the performance of the MariaDB and MySQL optimizers is available at: http:
//blog.mariadb.org/mariadb-5-3-optimizer-benchmark.
11 Group Commit documentation: http://kb.askmonty.org/en/group-commit-for-the-binary-log
12 Table Elimination documentation: http://kb.askmonty.org/en/table-elimination