This is incredible, by the way. Any time MySQL needs to use a tmp table on disk, you can make it use RAM disk instead.
WARNING: if the tmpfs partition you make isn’t big enough, MySQL will not be able to complete queries. Make sure you have enough RAM to do this.
mkdir /tmp/mysqltmp
chown mysql:mysql /tmp/mysqltmp
id mysql
# example: uid=502(mysql) gid=503(mysql) groups=503(mysql)
#to set up on server restart, put in fstab something like (replace gid, uid with number from above)
tmpfs /tmp/mysqltmp tmpfs rw,gid=503,uid=502,size=2G,nr_inodes=10k,mode=0700 0 0
mount /tmp/mysqltmp
# you don't need this:
# mount -o size=2g,gid=520,uid=518,nr_inodes=10k,mode=0700 -t tmpfs tmpfs /tmp/mysqltmp
#edit my.cnf, adding
tmpdir=/tmp/mysqltmp/
restart mysql
Read moreUsing tmpfs for MySQL tmpdir setting