21/09/2013

Why use MariaDB instead of MySQL?

MySQL, MariaDB

Josep Sanz

After several business transactions that have led to MySQL from one side to another, finally now owned by Oracle (company dedicated to commercialize other proprietary DBMS). From my point of view (I don't know if this expression is correct in english!!!), these facts have led to the MySQL open source project to live an overall deterioration since this database management system (DBMS) currently offers a very low yield, which is latent in SaltOS when the system has a large number of data.

The tests I use to optimize queries of SaltOS uses a predefined data packet and running on SQLite and MySQL (the currently supported DBMS). To measure the response time, I use the time and the wget commands from the command line, so I can get a quick idea of ​​the efficiency of queries while I'm developing. The differences between these two systems for the queries related to the email application and the same data set are:

  • page=correo&action=list: 289ms (SQLite) vs 1548ms (MySQL)
  • page=correo&action=quickform: 286ms (SQLite) vs 1380ms (MySQL)
As can be seen, the difference is substantial: SQLite only requires 20% approx. that the time needed by MySQL. After reviewing and trying to make optimizations, all useless by the way, I discovered MariaDB, a fork of the MySQL project, by one of the authors of MySQL who left his job after understanding, without anyone to explain anything, of the intentions that had the new company with MySQL. I installed quickly this replacement on my laptop, from the project's own repositories for Fedora 17 and voila, already had a running MariaDB instead of MySQL. My surprise was substantial when you run the tests for the same application, I observed that queries MariaDB ran with speeds similar to those of SQLite:
  • page=correo&action=list: 288ms (SQLite) vs 413ms (MariaDB)
  • page=correo&action=quickform: 285ms (SQLite) vs 335ms (MariaDB)
Incredibly, it had reduced the runtimes of MariaDB without make anything. Everything still works ok, phpMyAdmin works ok, Saltos works ok and RhinOS too works ok on MariaDB, the really free replacement of MySQL. See the link for more info about the MariaDB project:
How to install MariaDB in Fedora 17?

The installation process of the MariaDB in fedora 17 is very simple, just follow these steps and voila:

1) Add the MariaDB repository

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora17-amd64
gpgcheck = 1
enabled = 1

2) Run the following commands

service mysqld stop
rpm -e --nodeps mysql-libs mysql-client mysql-server
rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB
yum install MariaDB-server MariaDB-client MariaDB-common MariaDB-compat MariaDB-shared
service mysql start
service httpd restart

3) If when you access to phpMyAdmin, do you get the error about that the mysqli extension is not found, it's because you're using the php-mysql package instead of php-mysqlnd, and can be solved formally doing:

rpm -e --nodeps php-mysql
yum install php-mysqlnd
service httpd restart

Notes:
  • You can ignore the error messages that appear saying that there are some mysql needed files, because when you install MariaDB, dependencies are checked and detect that there are packages that have dependencies of the uninstalled packages.
  • Regarding the repositories: there are all these repositories (the example install the Fedora 17 to 64 bits repository):
    • centos5-amd64
    • centos5-x86
    • centos6-amd64
    • centos6-x86
    • fedora16-amd64
    • fedora16-x86
    • fedora17-amd64
    • fedora17-x86
    • rhel5-amd64
    • rhel5-x86
    • rhel6-amd64
    • rhel6-x86
Updated (2013-09-07):

Great news: Fedora 19 has replaced MySQL by MariaDB. Like many other distributions, when installing Fedora 19, is installed MariaDB by default instead of MySQL.


XML lines
60,895
PHP lines
18,657
JS lines
11,620
XSLT lines
2,498
CSV lines
1,919
CSS lines
577