Databases 8 min read

Performance Comparison Between MariaDB and MySQL

This article reviews the history of MySQL, introduces MariaDB as its open‑source fork, and presents a series of benchmark tests—including single‑row inserts, batch inserts, and various query scenarios—showing that MariaDB generally outperforms MySQL in speed while using more memory.

Architecture Digest
Architecture Digest
Architecture Digest
Performance Comparison Between MariaDB and MySQL

In recent years many developers have praised MariaDB and abandoned MySQL; this article summarizes the advantages of MariaDB over MySQL.

MySQL development history : MySQL originated in 1979 by Michael Widenius, evolved through several versions, became open‑source under GPL in 2000, introduced InnoDB in 2001, was acquired by Sun in 2008, and later by Oracle in 2009, after which its development direction changed.

What is MariaDB? MariaDB is a fork of MySQL created by Widenius before MySQL could become closed‑source. It aims for full compatibility with MySQL APIs and command‑line tools, uses XtraDB as its default storage engine, and follows the same versioning up to 5.5 before diverging to its own 10.x series, offering better performance and features.

Test environment :

CPU: i7

Memory: 8 GB

OS: Windows 10 64‑bit

Disk: SSD

MySQL: 8.0.19

MariaDB: 10.4.12

Both databases created a performance database with a log table using InnoDB:

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 tests showed MariaDB was about twice as fast as MySQL.

Batch insert tests indicated MariaDB generally performed better on average, though not always superior.

Query performance (no index)

Counting rows: MariaDB 3.065 s vs MySQL 6.404 s.

Range query on time with ordering: MariaDB 6.996 s vs MySQL 10.193 s.

Filtering by level='info': MariaDB 0.006 s vs MySQL 0.049 s.

Filtering by message='debug': MariaDB 0.003 s vs MySQL 0.004 s.

Query performance (with index)

Indexes were added on time, level, and a FULLTEXT index on message:

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

With indexes, MariaDB completed the same test suite in 2 min 47 s, while MySQL took 3 min 48 s; however, some indexed queries performed worse, illustrating that indexing every column is not always beneficial.

Conclusion

The benchmarks demonstrate that MariaDB’s performance is consistently better than MySQL’s in the tested scenarios, supporting the trend of many organizations migrating from MySQL to MariaDB.

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.

SQLmysqlBenchmarkDatabase PerformanceMariaDB
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

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.