Databases 9 min read

Why MariaDB Outperforms MySQL: A Detailed Performance Comparison

This article traces MySQL’s evolution, introduces MariaDB’s origins, and presents a comprehensive benchmark comparing insert and query performance of MySQL 8.0.19 and MariaDB 10.4.12 on identical hardware, highlighting speed differences with and without indexes.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Why MariaDB Outperforms MySQL: A Detailed Performance Comparison

History of MySQL

MySQL’s history dates back to 1979 when its founder Michael Widenius created an API for a reporting tool that later incorporated SQL support using mSQL code. Unsatisfied, he decided to build his own database. MySQL 1.0 was released in 1996, followed by version 3.11.1 for Solaris in October 1996 and a Linux version a month later. In 1999 Michael founded MySQL AB, transitioning development from an individual to a team, and in 2000 MySQL was open‑sourced under the GPL. In 2001 the InnoDB storage engine appeared and remains the dominant engine. Sun acquired MySQL AB in 2008 for $1 billion, releasing MySQL 5.1 later that year. Oracle bought Sun in 2009, bringing MySQL under Oracle’s control. MySQL 5.5 (2010) made InnoDB the default engine, but Oracle’s later actions raised concerns about the project’s openness.

What Is MariaDB and Why It Appeared

MariaDB is a fork of MySQL created by Michael Widenius (whose daughter’s nickname “My” inspired the original name). Disappointed by Oracle’s direction, Widenius launched MariaDB to preserve a fully open‑source MySQL‑compatible system. It uses the XtraDB engine instead of InnoDB, aims for 100% compatibility with MySQL APIs and command‑line tools, and has evolved independently with version numbers starting at 10.0. Today MariaDB often matches or exceeds MySQL’s performance.

Test Environment

The performance tests were conducted on the following hardware and software:

CPU: i7

Memory: 8 GB

OS: Windows 10 64‑bit

Disk: SSD

MySQL: 8.0.19

MariaDB: 10.4.12

Both databases were used to create a performance database with a log table (InnoDB engine) using the following schema:

CREATE TABLE `performance`.`log` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `time` DATETIME NOT NULL,
  `level` ENUM('info','debug','error') NOT NULL,
  `message` TEXT NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=INNODB CHARSET=utf8;

Insert Performance

Single Row Insert

Results for inserting rows one by one:

MariaDB’s single‑row insert speed is roughly twice that of MySQL.

Batch Insert

Results for batch inserts:

MariaDB does not have an absolute advantage; sometimes it is slower, but on average it outperforms MySQL.

Query Performance

After populating both databases with millions of rows, the following queries were executed. SELECT COUNT(0) FROM LOG; Both tables contained 6,785,000 rows. MariaDB returned the count in 3.065 s, MySQL in 6.404 s. MariaDB used 474 MB of RAM, MySQL only 66 MB.

Without Index

Maximum and minimum timestamps: SELECT MAX(TIME), MIN(TIME) FROM LOG; MariaDB: 6.333 s, MySQL: 8.159 s.

Filtering rows between 00:00 and 01:00 and sorting by time:

SELECT * FROM LOG WHERE TIME > '2020-02-04 00:00:00' AND TIME < '2020-02-04 01:00:00' ORDER BY TIME;

MariaDB: 6.996 s, MySQL: 10.193 s.

Querying rows where level='info': SELECT * FROM LOG WHERE LEVEL = 'info'; MariaDB: 0.006 s, MySQL: 0.049 s.

Querying rows where message='debug': SELECT * FROM LOG WHERE MESSAGE = 'debug'; MariaDB: 0.003 s, MySQL: 0.004 s.

With Index

Indexes were added to time, level, and a full‑text index on message:

ALTER TABLE `performance`.`log`
  ADD INDEX `time`(`time`),
  ADD INDEX `level`(`level`),
  ADD FULLTEXT INDEX `message`(`message`);

Creating the indexes took MariaDB 2 min 47 s and MySQL 3 min 48 s. The indexed queries yielded the results shown below:

Some indexed queries performed worse than their non‑indexed counterparts, indicating that not every column benefits from indexing.

Conclusion

The benchmarks demonstrate that MariaDB generally outperforms MySQL in both insert and query scenarios on the tested hardware, providing a solid technical reason for many organizations to prefer MariaDB over MySQL.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLInnoDBmysqlBenchmarkMariaDB
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.