Why does MySQL produce so many temporary MYD files?
http://dba.stackexchange.com/questions/30505/why-does-mysql-produce-so-many-temporary-myd-files
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. |
||||
There are some options that can cause temp tables to materialize as
MyISAM tables or can be configured to delay it. Keep in mind that for
disk-based temp tables, there are no 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 on Disk, here is one desperate move: Mapping disk-based temp table creation to memory. 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 you can get clues to make a good guess from SHOW FULL PROCESSLIST; or SHOW INNODB STATUS; or by looking in your error log if the queries fail. |
|||
Whenever we use alter statements on table It creates the #sql_6405_3.MYD temporay files and once it‘s done throws the output and disappears. Alter on tables make MySQL to copy whole data into temporary files #sql.xxx.MYD and make changes to created temporary files then drop original data files tablename.MYD and renames the temporay files to table name. Also for some kinda sorting queries it creates temporary files. As I traced out. This thing happens. |
|||
Your Answer
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
filesort
, and 6405 is the PID of mysql to keep temp files from different server instances separate. – Marc B Dec 15 ‘12 at 20:27