Performance Comparison of MySQL 8.0.19 and MariaDB 10.4.12: Insert, Query, and Index Benchmarks
This article presents a detailed benchmark comparing MySQL 8.0.19 and MariaDB 10.4.12 on a Windows 10 i7 machine, covering single‑row and batch inserts, various SELECT queries with and without indexes, and analyzes the trade‑off between speed and memory usage.
MariaDB inherits the MySQL lineage but has diverged since version 10.0, offering full MySQL compatibility while claiming superior performance and features.
Test Environment
CPU: Intel i7
Memory: 8 GB
OS: Windows 10 64‑bit
Disk: SSD
MySQL: 8.0.19
MariaDB: 10.4.12
Both databases were set up with a performance database and a log table using the InnoDB engine:
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
The single‑row insert test shows MariaDB inserting roughly twice as fast as MySQL.
Batch Insert
In batch insert scenarios MariaDB does not always dominate; sometimes it is slower, but on average it still outperforms MySQL.
Query Performance (No Index)
After loading millions of rows, the following queries were executed:
SELECT COUNT(0) FROM LOG;MariaDB returned the count in 3.065 s using 474 284 KB memory, while MySQL took 6.404 s with only 66 848 KB.
SELECT MAX(TIME), MIN(TIME) FROM LOG;MariaDB: 6.333 s, MySQL: 8.159 s.
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.
SELECT * FROM LOG WHERE LEVEL = 'info';MariaDB: 0.006 s, MySQL: 0.049 s.
SELECT * FROM LOG WHERE MESSAGE = 'debug';MariaDB: 0.003 s, MySQL: 0.004 s.
Query Performance (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. Subsequent benchmark results are shown below:
Some indexed queries performed worse than their non‑indexed counterparts, indicating that indiscriminate indexing is not always beneficial.
Conclusion
The tests demonstrate that MariaDB generally offers better performance than MySQL for the examined workloads, albeit with higher memory consumption, which explains why many organizations are migrating from MySQL to MariaDB.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.