http://dba.stackexchange.com/questions/30505/why-does-mysql-produce-so-many-temporary-myd-files
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It‘s 100% free, no registration required.
Why does MySQL produce so many temporary MYD files?
up vote 3 down vote favorite 3 |
On a Debian Linux server, hosting many PHP/MySQL websites (photo galleries), sometimes I have "many" files like For example today :
(59 files at the same time, for more than 6GB... yes I monitor big files in /tmp) Unfortunately, All the file names follow the
|
||||||||
migrated from stackoverflow.com Dec 16 ‘12 at 2:08This question came from our site for professional and enthusiast programmers. |
|||||||||
|
3 Answers
There are some options that can cause temp tables to materialize as Here are the options:
You should also consider the MySQL Documentation on Internal Temp Table Usage The situations where in-memory temp tables are made are
When an in-memory temp table exceeded the minimum of (tmp_table_size or max_heap_table_size), mysqld does the following:
The situations where in-memory temp tables are bypassed in favor of disk are
Some due diligence is required to reduce temp table creation on disk
If after such due diligence, there are still temp tables being formed Here is a quick-and-dirty way to set up a 16GB RAM Disk using tmpdir STEP01) Create RAM Disk Folder
STEP02) Add this to
STEP03) Add this to /etc/fstab
STEP04) Reload /etc/fstab
STEP05) After this, all temp table that become MyISAM are written to the RAM Disk. This should speed disk-based temp table creation. Give it a Try !!!
|
|||
These are queries that are rolling over onto disk because the results are too large for memory. When the query is done, the space clears. There‘s no way to match these temp files definitively to queries, but
|
|||
Whenever we use alter statements on table It creates the Alter on tables make MySQL to copy whole data into temporary files Also for some kinda sorting queries it creates temporary files. As I traced out. This thing happens.
|
|||