To speed up the site, it is recommended to transfer temporary MySQL files to RAM. This is the easiest and most effective way to improve the performance of your sites and projects. In this case, MySQL will work with temporary tables through RAM. The difference will be noticeable even if you have a VPS server with SSD drives.
1. Create a folder for MySQL temporary files. For example, to create the /var/lib/mysql/temp folder, enter:
2. Change the group and owner of the created folder to mysql:
crown mysql: /var/lib/mysql/temporary
3. If you are not sure exactly, then specify the MySQL user and group ID using the command:
4. To open the /etc/fstab file run:
5. Add the following line to this file:
tmpfs /var/lib/mysql/temporary tmpfs rw,gid=27,uid=27,size=1G,nr_inodes=10k,mode=0700 0 0
size is the amount of RAM allocated for MySQL temporary files, in our example it is 1G. Be sure to consider the amount of available RAM on the virtual server.
6. Connect the new partition:
7. Open the config file MySQL:
8. Add the line to the config file:
9. Restart MySQL:
systemctl restart mysqld
It is also recommended to optimize the site's database to improve the efficiency of the site (using the correct sizes and types of fields, taking into account the content, adjusting indexes and creating queries in accordance with these indexes).
If you still have questions, please create a ticket to technical support.