Question on Copying to tmp table
"Ilavajuthy Palanisamy" <[email protected]>
| Newsgroups | gmane.comp.db.mysql.windows |
|---|---|
| Message-ID | <52BBA75459915749B68F93B604B636CD0159E7F3@neptune.TidalNetworks.net> |
Hi, I need information on Copying to tmp table status. Explain for some of our query shows 'Using temporary, Using Filesort'. When query goes into this state it takes very long time. Need to understand the state using temporary and using filesort. For e.g. the query; Select userid, sum(bandwidth) as bw from mfs group by userid order by bw DESC limit 10; When the query says copying to tmp table, what it is copying? And where it is copying? Is it copying the computed data (in this case sum(bandwidth) to tmp table? What is the use of the variable max_tmp_tables? In my case it is set to 2. What happens if I execute 3 queries at the same time which requires tmp table? I have set the tmp_table_size = 32MB. Based on what condition does mysqld determines that it has to store the temporary data in memory or disk? Does it determine before executing the query? Or first it will copy the temporary table to memory and determining it is not enough and then copies to disk? Also there is a restriction of 4GB for table size, when it copies the data to tmp table, what will happen if the tmp table size exceeds 4GB limit? Ila.