1125Sending data

-- Sending data具体干什么
The thread IS processing ROWS FOR a SELECT statement AND also IS sending DATA TO the client.

-- 比较浪费时间的操作
Copying TO tmp TABLE
The SERVER IS copying TO a TEMPORARY TABLE IN memory.

Copying TO tmp TABLE ON DISK
The SERVER IS copying TO a TEMPORARY TABLE ON disk.
The TEMPORARY result SET was larger THAN tmp_table_size AND the thread IS changing the TEMPORARY TABLE FROM IN-MEMORY TO DISK-based FORMAT TO save memory.

sending DATA虽然字面上看起来好像这个状态意味着在给客户端发送数据而已,
实际上不完全是这样的,比如MySQL找到查询结果(30条记录,没有CACHE到内存中,散布在硬盘上不同的地方)了,
这样的话实际上要从这30个不同的地方取出这30条记录,也就是要寻道30次(特别散,CACHE不到 :)),
这个任务我觉得可以看成 The thread IS processing ROWS FOR a SELECT statement !

解决方法:这个时候也许要想办法去增加内存,让MySQL不但将INDEX能CACHE到内存中,才能够更多地将具体数据CACHE到内存中了!
SHOW VARIABLES LIKE '%tmp_table_size%'

posted @ 2016-11-25 14:45  秦楚风  阅读(149)  评论(0编辑  收藏  举报