MySQL profile 中 Sending data 具体作了什么事情?

最近在优化项目数据库性能的时候发现 Sending data 耗费不少时间,网上查了不少,发现没人能确切的解释Sending data 在干什么。。。因而找到了官网的解释:html

Sending datamysql

The thread is reading and processing rows for a SELECT statement, and sending data to the client. Because operations occurring during this state tend to perform large amounts of disk access (reads), it is often the longest-running state over the lifetime of a given query.sql

 说Sending data 是:线程正在为一个select语句读取和处理行,而且发送数据到客户端。由于这期间操做倾向于大量的磁盘访问(读取),因此这常是整个查询周期中运行时间最长的阶段。(这是MySQL 5.5的解释,5.7的解释彻底同样,可是5.7多了一个Sending to client状态)数据库

这样就清楚了,Sending data 作了 读取,处理(过滤,排序等。。)和发送 三件事情,接下来再看该状态下的cpu 和 io 信息 以分析语句的瓶颈是 读取仍是处理 ,再作相应的优化调整。。。性能

 

其余状态的说明:https://dev.mysql.com/doc/refman/5.5/en/general-thread-states.html优化

相关文章
相关标签/搜索