Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

People also ask

What is system lock state in MySQL?

For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it). This should not be surprising since InnoDB does row-level locking. In addition, the gen_clust_index (a.k.a. Clustered Index) will experience Shared and Exclusive Locks on the Primary Key at some point.

How do I stop a process in MySQL?

MySQL does not have a unique command for killing all processes. To kill all processes for a specific user, use CONCAT to create a file with the list of threads and statements. In our case, we entered root as the user. To specify another user, replace root with the desired username.

What is show Processlist MySQL?

SHOW [FULL] PROCESSLIST. The MySQL process list indicates the operations currently being performed by the set of threads executing within the server. The SHOW PROCESSLIST statement is one source of process information. For a comparison of this statement with other sources, see Sources of Process Information.


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.

MySQL 8.0.17 and later: This state is no longer indicated separately, but rather is included in the Executing state.


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).

That's why it takes more time to complete and so is the longest-running state over the lifetime of a given query.