The MySQL show processlist command shows the execution status of each connection. Most connections will be completed quickly, but a few connections will always execute some operations in the background, the status shown by show processlist shows the status of the current connection execution, which gives us the details of the link.
After create
This occurs when the thread creates a table (including internal temporary tables), at the end of the function that creates the table. this state is used even if the table cocould not be created due to some error.
Analyzing
The thread is calculating a MyISAM Table key distributions (for example, for analyze table ).
Checking Permissions
The thread is checking whether the server has the required privileges to execute the statement.
Checking table
The thread is refreshing Ming a table check operation.
Cleaning up
The thread has processed one command and is preparing to free memory and reset certain state variables.
Closing tables
The thread is flushing the changed table data to disk and closing the used tables. this shoshould be a fast operation. if not, you shoshould verify that you do not have a full disk and that the disk is not in very heavy use.
Converting heap to MyISAM
The thread is converting an internal temporary table from a memory table to an on-disk MyISAM table.
Copy to TMP table
The thread is processing an alter table statement. This State occurs after the table with the new structure has been created but before rows are copied into it.
Copying to group table
If a statement has different order by and group by criteria, the rows are sorted by group and copied to a temporary table.
Copying to TMP table
The server is copying to a temporary table in memory.
Copying to TMP table on disk
The server is copying to a temporary table on disk. the temporary result set has become too large (see section 8.8.5, "how MySQL uses internal temporary tables "). consequently, the thread is changing the temporary table from in-memory to disk-based format to save memory.
Creating Index
The thread is processing alter table... Enable keys for a MyISAM table.
Creating sort Index
The thread is processing a select that is resolved using an internal temporary table.
Creating table
The thread is creating a table. This includes des creation of temporary tables.
Creating TMP table
The thread is creating a temporary table in memory or on disk. if the table is created in memory but later is converted to an on-disk table, the State during that operation will be copying to TMP table on disk.
Deleting from main table
The server is executing the first part of a multiple-Table Delete. it is deleting only from the first table, and saving columns and offsets to be used for deleting from the other (reference) tables.
Deleting from reference tables
The server is executing the second part of a multiple-table delete and deleting the matched rows from the other tables.
Discard_or_import_tablespace
The thread is processing an alter table... Discard tablespace or alter table... Import tablespace statement.
End
This occurs at the end but before the cleanup of alter table, create view, delete, insert, select, or update statements.
Executing
The thread has begun executing a statement.
Execution of init_command
The thread is executing statements in the value of the init_command system variable.
Freeing items
The thread has executed a command. Some freeing of items done during this state involves the query cache. This state is usually followed by cleaning up.
Flushing tables
The thread is executing flush tables and is waiting for all threads to close their tables.
Fulltext Initialization
The server is preparing to perform a natural-language full-text search.
Init
This occurs before the initialization of alter table, delete, insert, select, or update statements. actions taken by the server in this state include flushing the binary log, the InnoDB log, and some query cache cleanup operations.
For the end state, the following operations cocould be happening:
Removing query cache entries after data in a table is changed
Writing an event to the binary log
Freeing memory buffers, including for blobs
Killed
Someone has sent a kill statement to the thread and it shocould abort next time it checks the kill flag. the flag is checked in each major loop in MySQL, but in some cases it might still take a short time for the thread to die. if the thread is locked by some other thread, the kill takes effect as soon as the other thread releases its lock.
Locked
The query is locked by another query.
Logging slow Query
The thread is writing a statement to the slow-query log.
Null
This state is used for the show processlist state.
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 tables, opening table
The thread is trying to open a table. this is shoshould 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.
Optimizing
The server is refreshing Ming 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.
Reading from net
The server is reading a packet from the network.
Removing duplicates
The query was using select distinct in such a way that MySQL cocould 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.
Reopen tables
The thread got a lock for the table, but noticed after getting the lock that the underlying table structure changed. It has freed the lock, closed the table, and is trying to reopen it.
Repair by sorting
The repair code is using a sort to create indexes.
Repair done
The thread has completed a multi-threaded repair for a MyISAM table.
Repair with keycache
The repair code is using creating keys one by one through the key cache. This is much slower than repair by sorting.
Rolling back
The thread is rolling back a transaction.
Saving state
For MyISAM Table operations such as repair or analysis, the thread is saving the new table state to. myi file header. state events des information such as number of rows, the auto_increment counter, and key distributions.
Searching rows for update
The thread is doing a first phase to find all matching rows before updating them. This has to be done if the update is changing the index that is used to find the involved rows.
Sending data
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.
Setup
The thread is beginning an alter table operation.
Sorting for group
The thread is doing a sort to satisfy a group.
Sorting for order
The thread is doing a sort to satisfy a order.
Sorting index
The thread is Sorting index pages for more efficient access during a MyISAM Table optimization operation.
Sorting result
For a SELECT statement, this is similar to creating sort index, but for nontemporary tables.
Statistics
The server is calculating statistics to develop a query execution plan. If a thread is in this state for a long time, the server is probably disk-bound implements Ming other work.
System lock
The thread is going to request or is waiting for an internal or external system lock for the table. if this state is being caused by requests for external locks and you are not using multiple mysqld servers that are accessing the same MyISAM tables, you can disable External system locks with the-Skip-external-locking option. however, external locking is disabled by default, so it is likely that this option will have no effect.
Table lock
The next thread state after system lock. The thread has acquired an external lock and is going to request an internal table lock.
Updating
The thread is searching for rows to update and is updating them.
Updating main table
The server is executing the first part of a multiple-Table update. It is updating only the first table, and saving columns and offsets to be used for updating the other (reference) tables.
Updating reference tables
The server is executing the second part of a multiple-Table update and updating the matched rows from the other tables.
User lock
The thread is going to request or is waiting for an advisory lock requested with a get_lock () call. for show profile, this State means the thread is requesting the lock (not waiting for it ).
User sleep
The thread has invoked a sleep () call.
Waiting for release of readlock
The thread is waiting for a global read lock obtained by another thread (with flush tables with read lock) to be released.
Waiting for tables, waiting for table
The thread got a notification that the underlying structure for a table has changed and it needs to reopen the table to get the new structure. however, to reopen the table, it must wait until all other threads have closed the table in question.
This notification takes place if another thread has used flush tables or one of the following statements on the table in question: flush tables tbl_name, alter table, rename table, repair table, analyze table, or optimize table.
Waiting on cond
A generic state in which the thread is waiting for a condition to become true. No specific State information is available.
Waiting to get readlock
The thread has issued a flush tables with read lock statement to obtain a global read lock and is waiting to obtain the lock.
Writing to net
The server is writing a packet to the network.