MySQL MySQL处于“正在发送数据”状态是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10347193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does it mean when MySQL is in the state "Sending data"?
提问by user1345414
What does it mean if the Mysql query:
如果 Mysql 查询是什么意思:
SHOW PROCESSLIST;
returns "Sending data" in the State column?
在状态列中返回“正在发送数据”?
I imagine it means the query has been executed and MySQL is sending “result” Data to the client but I'm wondering why its taking so much time (up to an hour).
我想这意味着查询已经执行并且 MySQL 正在向客户端发送“结果”数据,但我想知道为什么它需要这么多时间(最多一个小时)。
Thank you.
谢谢你。
回答by Quassnoi
This is quite a misleading status. It should be called "reading and filtering data".
这是一个相当误导的状态。它应该被称为“读取和过滤数据”。
This means that MySQL
has some data stored on the disk (or in memory) which is yet to be read and sent over. It may be the table itself, an index, a temporary table, a sorted output etc.
这意味着MySQL
有一些数据存储在磁盘(或内存)中,但尚未被读取和发送。它可能是表本身、索引、临时表、排序输出等。
If you have a 1M records table (without an index) of which you need only one record, MySQL
will still output the status as "sending data" while scanning the table, despite the fact it has not sent anything yet.
如果你有一个 1M 的记录表(没有索引),你只需要一个记录,MySQL
在扫描表时仍然会输出状态为“发送数据”,尽管它尚未发送任何内容。
回答by Venkatesh Kalikiri
In this state:
在这种状态下:
The thread is reading and processing rows for a SELECT statement, and sending data to the client.
Because operations occurring during this this state tend to perform large amounts of disk access (reads).
该线程正在读取和处理 SELECT 语句的行,并将数据发送到客户端。
因为在此状态期间发生的操作往往会执行 大量磁盘访问(读取)。
That's why it takes more time to complete and so is the longest-running stateover the lifetime of a given query.
这就是为什么需要更多时间才能完成,并且在给定查询的生命周期内运行时间最长的状态也是如此。