Show processlist shows which threads are running. You can also useMysqladmin processlistStatement. If you have super permission, you can see all the threads. Otherwise, you can only view your own thread (that is, the Thread associated with the MySQL account you are using ). See section 13.5.5.3 "Kill Syntax ". If you do not use the full keyword, only the first 100 characters of each query are displayed.
This statement reports the name of the host connected by TCP/IP (usingHost_name:Client_portFormat) to determine which client is doing.
This statement is useful if you get the "too many ons" error message and want to know what is happening. MySQL retains an additional connection for the account with the super permission to ensure that the administrator can connect to and check the system at any time (assuming that you have not granted this permission to all users ).
The most important part of this command is the State column. MySQL lists the following states:
Checking table
Checking the data table (this is automatic ).
Closing tables
Refreshing the modified data in the table to the disk and closing the used table. This is a very fast operation. If not, check whether the disk space is full or the disk is under a heavy load.
Connect out
The replication slave server is connecting to the master server.
Copying to TMP table on disk
Because 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
Creating a temporary table to store some query results.
Deleting from main table
The server is executing the first part of multi-Table deletion. The first table has just been deleted.
Deleting from reference tables
The server is executing the second part of multi-Table deletion and is deleting records of other tables.
Flushing tables
Executing flush tables, waiting for other threads to close the data table.
Killed
If a kill request is sent to a thread, the thread will check the kill flag and discard the next kill request. MySQL checks the kill flag in each primary loop.
But in some cases, the thread may die after a short period of time. If the thread is locked by other threads, the kill request will take effect immediately when the lock is released.
Locked
It is locked by other queries.
Sending data
Processing the record of the SELECT query and sending the result to the client.
Sorting for group
Sorting for group.
Sorting for order
Sorting order.
Opening tables
This process should be fast unless it is disturbed by other factors. For example, a data table cannot be opened by another thread before the alter table or lock TABLE statement is executed. Opening a table.
Removing duplicates
A select distinct query is being executed, but MySQL cannot optimize those duplicate records in the previous stage. Therefore, MySQL needs to remove duplicate records and then send the results to the client.
Reopen table
A lock is obtained for a table, but the lock can be obtained only after the table structure is modified. The lock has been released, the data table is closed, and the data table is being re-opened.
Repair by sorting
The repair command is being sorted to create an index.
Repair with keycache
The repair command is using the index cache to create a new index one by one. It is slower than repair by sorting.
Searching rows for update
We are talking about identifying qualified records for updates. It must be completed before the related record is updated.
Sleeping
Waiting for the client to send a new request.
System lock
Waiting for an external system lock to be obtained. If multiple mysqld servers are not running to request the same table at the same time, you can add the -- skip-external-locking parameter to disable External system locks.
Upgrading lock
Insert delayed is trying to get a lock table to insert a new record.
Updating
Searching for matched records and modifying them.
User lock
Waiting for get_lock ().
Waiting for tables
This thread is notified that the data table structure has been modified. You need to re-open the data table to obtain the new structure. Then, in order to re-open the data table, you must wait until all other threads close the table. The following types
In this case, this notification will be generated: flush tables tbl_name, alter table, rename table, repair
Table, analyze table, or optimize table.
Waiting for Handler insert
Insert delayed has completed all the insert operations to be processed and is waiting for new requests.
Most States correspond to fast operations. As long as one thread remains in the same state for several seconds, a problem may occur and you need to check it.
Other statuses are not listed above, but most of them are only needed to check whether there are errors on the server.
View current connections in MySQL
Command: Show processlist;
If it is a root account, you can see the current connection of all users. For other common accounts, you can only view the connections you are using.
Show processlist; only the first 100 items are listed. If you want to list them all, use show full processlist;
Mysql> show processlist;
Command: Show status;
Aborted_clients indicates the number of dropped connections because the client fails to properly close the connection.
The number of connection times of the MySQL server that failed the aborted_connects attempt.
The number of times that connections attempted to connect to the MySQL server.
Created_tmp_tables: Number of implicit temporary tables created when the statement is executed.
The number of threads that delayed_insert_threads is using to insert a delayed processor.
The number of rows written by delayed_writes Using Insert delayed.
The number of rows in which delayed_errors writes data using insert delayed (which may duplicate key values.
The number of times flush_commands executes the flush command.
The number of rows that handler_delete requests to delete from a table.
The number of times the handler_read_first request reads the first row of the table.
The handler_read_key request number is based on the key-read row.
The number of times the handler_read_next request reads a row based on a key.
The number of times the handler_read_rnd request reads a row based on a fixed position.
The number of times handler_update requests to update a row in the table.
The number of times a handler_write request inserts a row into a table.
The number of key_blocks_used Blocks Used for keyword cache.
The number of times key_read_requests requests read a key value from the cache.
The number of times that key_reads reads a key value from the disk physically.
Number of times that key_write_requests requests write a key block to the cache.
The number of times that key_writes physically writes a key-Value block to a disk.
The maximum number of connections simultaneously used by max_used_connections.
Not_flushed_key_blocks has been changed in the key cache but has not been cleared to the disk.
The number of rows that not_flushed_delayed_rows is waiting to write in the insert delay queue.
The number of open tables in open_tables.
The number of open files in open_files.
Number of open streams in open_streams (mainly used for log recording)
The number of open tables in opened_tables.
The number of queries sent by questions to the server.
Slow_queries takes more than long_query_time.
The number of connections currently opened by threads_connected.
The number of threads whose threads_running is not sleeping.
How many seconds does the uptime server work.
[Turn] From http://www.cnblogs.com/JulyZhang/archive/2011/01/28/1947165.html