OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Why is MySQL using /tmp?

From: Amr Mostafa (amr.mostafagmail.com)
Date: Thu Jun 11 2009 - 02:02:33 CDT


If I understand the manual correctly, it uses /tmp for creating temporary
tables if their size exceed the smaller of tmp_table_size or
max_heap_table_size, otherwise, it will create the temporary table in
memory. So if tmp_table_size is set to say 10Mb, and MySQL needs to create a
temporary table internally (which it does need for sorting and other stuff)
which would be about 20Mb, it's going to create it in /tmp. If that
temporary table had been 5Mb, it would have created it in memory.

I'm not sure how to calculate the needed space for /tmp. Check this for how
to change the tmp directory location:

http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_tmpdir

Cheers,
Amr

On Thu, Jun 11, 2009 at 8:51 AM, Mike Spreitzer <mspreitzus.ibm.com> wrote:

> I find my MySQL Community Edition 5.1.34 server running out of space on
> /tmp (which is indeed small). Why is it using /tmp? How much free space
> do I need on /tmp? Can/should I make the server use a different location
> instead of /tmp?
>
> Thanks,
> Mike Spreitzer
>