Ubuntu 18 and tmpdir

2nd hand info from my DBA, I’m more of an OS guy

While testing, we added an index to a large table: ALTER TABLE … ADD INDEX …

We eventually received the error:
Error Code: 1878. Temporary file write failure. 474.219 sec

My DBA pointed the tmpdir to another location for testing purposes and it was fine.

I’m running Ubuntu 18, and what I’ve gathered so far just resizing /tmp (it’s currently only 1GB - this is just a generalized VM template I use) is not the solution and I need to read up on tmpfs. It appears it might default to half of the RAM assigned to the server (virtual machine).

So does it make sense that I’ll just update /etc/fstab and set /dev/shm to be hardcoded with “size=64G”?

1 Like

Indeed long alters may demand lot of intermediate disk space. This is described here:
https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-space-requirements.html
and
https://dev.mysql.com/doc/refman/8.0/en/temporary-files.html
Assigning 64G of RAM for tmpfs seems like an overkill, MySQL should be able to utilize free memory much better in InnoDB Buffer Pool, while usually tmpdir pointed to big enough disk partition works just fine.

1 Like