Sunday, June 25, 2006

Faster JOINs in MySQL Cluster 5.1 using Replication

Many of you have experienced performance problems with JOINs in MySQL Cluster. However, in MySQL 5.1, it is possible to address this using MySQL replication and create a read slave where the JOINs are performed.

It is possible to set a MySQL Cluster looking like this (very schematic):
To read more on how to setup the replication link beetween the Master and the Slave, see http://dev.mysql.com/doc/refman/5.1/en/replication.html .

The trick here is to make sure that the tables created using the NDBCluster engine are created on the slave MySQL server as MyISAM or in another storage engine more performant resolving JOINs.

This way you can now issue complex JOINs on the slave instead of on the cluster and the replication ensures that the changes you make on the NDBCluster tables will be replicated to the slave.


Unfortunately, it is not yet (will it ever be?) possible to let the Master MySQL server replicate its binlog to itself (into another database) in order to avoid the extra Slave MySQL server.

No comments: