mysql 5.5.44 linux 6.6
服务器设置了0.1秒的慢查询设置,有大量扫描很少记录的慢查询,系统很空闲,qps低(小于200)
UserHost: mcp[mcp] [10.10.200.200]
Query_time: 0.224793 Lock_time: 0.000041 Rows_sent: 6 Rows_examined: 12
SET timestamp=1508948809;select * from mcp_share_channel where share_id = '48' and channel_id !=6 order by sort asc;idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra
1SIMPLEmcp_share_channelrangeshare_idshare_id5NULL5Using where; Using filesort
手工很难重现,通过用脚本做profiling,偶尔出现慢的查询,慢在““Sorting result”“上,6行记录,正常排序是很快的,偶尔会在sorting result上耗费很长时间。system_cpu异常,user_cpu也很大。
| Status | Duration | CPU_user | CPU_system | Context_voluntary | Context_involuntary | Block_ops_in | Block_ops_out | Messages_sent | Messages_received | Page_faults_major | Page_faults_minor | Swaps | Source_function | Source_file | Source_line |
| Sorting result | 0.507486 | 0.174973 | 0.576913 | 12 | 2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | exec | sql_select.cc | 2267 |
好像sorting result有什么竞争,请问是什么原因的?怎么分析这个问题,谢谢。