MySQL optimization - detailed explanation of show processlist command

SHOW PROCESSLIST shows which threads are running

Use mysql -uroot -e 'Show processlist' or mysqladmin processlist when not using at the mysql prompt

If you have root privileges, you can see all threads. Otherwise, you can only see the logged in user's own thread, usually only 100 threads are displayed. If you want to see more, you can use the full modification (show full processlist)

parameter

 id #ID identification, useful when you want to kill a statement
use #Currently connected user
host #Display which port of which ip this connection is sent from
db #Database name
command #Connection status, usually sleep, query ), connect (connect)
time #Connection duration, in seconds
state #Display the status of the current sql statement
info #Display this sql statement
 

The state of the state is very critical. The following table lists the main state and description of the state:

 

condition  describe
Checking table Checking the datasheet (this is automatic).
Closing tables Tables are being flushed to disk with modified data, and tables that have been exhausted are being closed. This is a quick operation, and if not, you should check to see if the disk space is full or if the disk is under heavy load.
Connect Out The replication slave is connecting to the master.
Copying to tmp table on disk Since the temporary result set is larger than tmp_table_size, the temporary table is being converted from memory storage to disk storage to save memory.
Creating tmp table A temporary table is being created to hold partial query results.
deleting from main table The server is performing the first part of a multi-table drop and has just dropped the first table.
deleting from reference tables The server is performing the second part of a multi-table delete, deleting records from other tables.
Flushing tables Executing FLUSH TABLES, waiting for other threads to close data tables.
Killed If a kill request is sent to a thread, the thread will check the kill flag and give up the next kill request. MySQL checks the kill flag on each main loop, but in some cases the thread may die after a short period of time. If the thread is locked by another thread, the kill request will take effect as soon as the lock is released.
   
Locked Locked by other queries.
   
Sending data The records of the SELECT query are being processed and the results are being sent to the client.
Sorting for group Sorting for GROUP BY.
Sorting for order Sorting for ORDER BY is in progress.
Opening tables This process should be quick unless other factors interfere. For example, the data table cannot be opened by other threads until the ALTER TABLE or LOCK TABLE statement is completed. Trying to open a table.
Removing duplicates A SELECT DISTINCT query is being executed, but MySQL cannot optimize out those duplicate records in the previous stage. Therefore, MySQL needs to remove the duplicate records again, and then send the result to the client.
   
Reopen table A lock was acquired on a table, but the lock must be acquired after the table structure has been modified. Lock has been released, data table closed, trying to reopen data table.
Repair by sorting Fix instruction is sorting to create index.
Repair with keycache The repair instruction is using the index cache to create new indexes one by one. It will be slower than Repair by sorting.
Searching rows for update Talking about qualifying records to find out for update. It must be done before the UPDATE is to modify the associated record.
Sleeping Waiting for the client to send a new request.
System lock Waiting to acquire an external system lock. If you are not currently running multiple mysqld servers requesting the same table at the same time, you can disable external system locks by increasing the --skip-external-locking parameter.
Upgrading lock INSERT DELAYED is trying to acquire a lock table to insert new records.
Updating Searching for matching records and modifying them.
User Lock Waiting for GET_LOCK().
Waiting for tables The thread is notified that the data table structure has been modified and the data table needs to be reopened to obtain the new structure. Then, in order to be able to reopen the data table, it must wait until all other threads close the table. This notification is generated in the following cases: FLUSH TABLES tbl_name, ALTER TABLE, RENAME TABLE, REPAIR TABLE, ANALYZE TABLE, or OPTIMIZE TABLE.
waiting for handler insert INSERT DELAYED has processed all pending insert operations and is waiting for a new request

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325743253&siteId=291194637