• login 

The initial state for a connection thread until the client has been authenticated successfully. 

• manage keys 

The server is enabling or disabling a table index. 

• Opening system tables 

The thread is trying to open a system table (for example, a time zone or log table). 

• Opening tables 

The thread is trying to open a table. This is should be very fast procedure, unless something prevents opening. For example, an ALTER TABLE  or a LOCK TABLE  statement can prevent opening a table until the statement is finished. It is also worth checking that your table_open_cache  value is large enough. 

For system tables, the Opening system tables  state is used instead. 

• optimizing 

The server is performing initial optimizations for a query. 

• preparing 

This state occurs during query optimization. 

• Purging old relay logs 

The thread is removing unneeded relay log files. 

• query end 

This state occurs after processing a query but before the freeing items  state. 

• Receiving from client 

The server is reading a packet from the client. 

• Removing duplicates 

The query was using SELECT DISTINCT  in such a way that MySQL could not optimize away the distinct operation at an early stage. Because of this, MySQL requires an extra stage to remove all duplicated rows before sending the result to the client. 

• removing tmp table 

The thread is removing an internal temporary table after processing a SELECT  statement. This state is not used if no temporary table was created. 

• rename 

The thread is renaming a table. 

• rename result table 

The thread is processing an ALTER TABLE  statement, has created the new table, and is renaming it to replace the original table. 

