Recently, I’ve been thinking about learning more about MariaDB. I don’t have much more than a basic background on MariaDB, but I also haven’t written an article for my MySQL series in a bit, so thought it would be a good opportunity to learn more but to also compare to something similar. With a very little background on MariaDB other than how it seeks to be a comparable replacement to MySQL, let’s look first into some basics of MariaDB, and then move onto the comparisons.
What Is MariaDB?
MariaDB is a Relational Database Management System (RDBMS) designed to be a replacement for MySQL. It is open-source software that is also free to use under the GNU General Public License. A big focus of MariaDB is its all-around speed. However, it doesn’t sacrifice performance and power. MariaDB is also known to be highly scalable. The team that supervises MariaDB focuses much of their concern on security, meaning they release updates to patch those breaches as quickly as possible. MariaDB also strives to work quickly on the web, in the cloud, or even on mobile. It is also ACID compliant.
Now that we’ve learned a little background on MariaDB, let’s look at the similarities/differences between MySQL and MariaDB.
Performance
When we talk about performance, we’ll look more at the capabilities than the actual speed, as both are very comparable. Both MySQL and Mariadb using partitioning, which especially helps with scalability. When scaling, performance becomes more important. For faster performance, you also need to utilize the space you are given well. Both MySQL and MariaDB use row compression.
MariaDB also uses thread pools. If you’ve never heard of thread pools, think about connections attempting to link to the database. The connection would pick up a thread to query the database. With thread pooling, there are a series of open threads pooled together and not being used. When a connection needs one of those threads, it can just pick it up and use it to query the database, then drop it again when it has finished. That way, a thread isn’t created every time a connection is opened. Now, MySQL does have the ability to thread pool. However, it is only available on the Enterprise level. This means that the free-to-use community version does not include thread pooling.
Because MariaDB tries to build on what MySQL does, so many other features speed up the performance of MariaDB. One such feature is query result caching. Another is parallel queries but also read/write splitting. There are many more, but these are just a few.
True Open-Source
So, both MySQL and MariaDB are open-source. However, MySQL is owned by Oracle. This means, yes, there is some open-source code in their community edition. However, there is also proprietary code. That code isn’t available for everyone, as it’s just available as features at their enterprise level. With MariaDB, it is truly open-source, meaning that with their updates, they even accept outside contributions to establish more features and capabilities.
Database Capabilities
MySQL and MariaDB have very comparable general options, which is why they are so similar. However, MariaDB has several additions that improve on MySQL. For example, MariaDB has a memory storage engine that makes caches and indexes faster. This means something like an INSERT statement can be completed 24% faster than a MySQL INSERT.
As mentioned before, MariaDB can handle thread pooling. However, what sets MariaDB apart is that it can handle 200,000 open connections or more when scaled properly. The process for replication is also safer and faster than with MySQL. Updates can also be done faster than updates using MySQL.
MariaDB, along with additional features, also has additional extensions and statements. For example, extensions such as JSON can be handled. For statements, MariaDB can execute a variety such as a WITH or KILL statement. Some of these features are new to MariaDB, and therefore not provided by MySQL.
MySQL has proprietary code offered in the Enterprise edition. In its offered features, there are some that MariaDB does not have. To address the missing features, MariaDB allows open-source plugins as an alternative.
Although MariaDB tries to be the improved version of MySQL, there are some important features that MariaDB does not have. For example, MySQL allows for dynamic columns while MariaDB does not.
Security and Administration
Both MariaDB and MySQL implement important security features such as encryption, password expiration, roles, privileges, and audition. Both also seem to allow for data masking. For advanced databases and data protection, Maria DB also adds query throttling and query result limiting.
Another important element is disaster recovery plans. MariaDB and MySQL support point-in-time recovery using both backup and restore tools and a binary log to roll forward transactions. However, MariaDB goes a step further. It allows for point-in-time rollbacks, which allows DBA’s to roll back their databases with little-to-no downtime.
Both MariaDB and MySQL combine multi-master clustering with a database proxy or router that provides continuous availability. To further its high availability, MariaDB also adds transaction replay, sessions restore capabilities, connection migration. This allows failures to be hidden from applications.
Conclusion
When compared to MySQL, MariaDB tries to a comparable resource. Because of this, MariaDB has many of the capabilities that MySQL has. However, it attempts to go a step further by adding a variety of features that MySQL does not have. MariaDB is also more focused on open-source, where their team even takes input on what features to add and how to improve. MariaDB is faster and tries to focus heavily on both security and performance. However, MariaDB also strives to be highly scalable.
When trying to decide what database to use, of course you should always consider your project needs. When it comes to comparing the details, MariaDB and MySQL are very similar. There aren’t too many aspects where one is missing something the other has. Of course, there are exceptions to that rule, but for the most part, MariaDB tries to be the improved version of MySQL. Because of this, I would think MariaDB should be given a shot. If you’re looking for something very familiar and proven, I would suggest sticking with the MySQL roots. However, if you’re looking for a new, strong database that has just as many useful features, I would suggest giving MariaDB a try.
After learning more about MariaDB, I have more interest in giving it a shot. Maybe I will even write a tutorial on how to use MariaDB later. But for now, I hope this comparison has been helpful and interesting. Until next time, cheers!
Read all my articles for free with my weekly newsletter, thanks!
Want to read all articles on Medium? Become a Medium member today!
Check out some of my recent articles:
After Nearly Five Years, I Left My Job
Three Popular Machine Learning Methods
Introducing Typer: A Python Library for Creating CLIs
References:
MariaDB vs. MySQL – Open Source Relational Databases | MariaDB
MariaDB vs MySQL: What is the Difference Between MariaDB and MySQL