Temporary files on RAM on PXC

percona

I manage a PXC 5.6 cluster and noticed that the tmpdir variable in /etc/my.cnf isn't set.

I was thinking to set it to /tmp (which is tmpfs) to explicitly make the cluster store temporary files in RAM. Without this setting, MySQL could choose /var/tmp or /usr/tmp (which, on my system, are on-disk) to store temporary files.

1) Is there any drawback to do this on PXC? I ask because on a MySQL replication slave one must not use a RAM disk to store temporary files, since the slave will need some of the files when the machine restarts.

2) Is this really going to improve performances, or it looks like a unnecessary twiddling? The InnoDB buffer size is already large enough, and 95% of temporary tables are stocked in memory.

Best Answer

It is not advisable to use RAM for temporary directory. At time files can grow large enough to outflow RAM and this would be true even with plain MySQL. RAM is best managed by InnoDB buffer pool. You can setup a tmpfs that should be good enough with decent performance.