What does it mean when MySQL is in the state “Sending data”?

前端 未结 2 1989
灰色年华
灰色年华 2020-11-28 21:53

What does it mean if the Mysql query:

SHOW PROCESSLIST;

returns \"Sending data\" in the State column?

I imagine it means the quer

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 22:10

    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.

    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.

提交回复
热议问题