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. However, 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. This notification is generated in the following situations: 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.
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 was larger than tmp_table_size and 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. 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.
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.
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.
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 processing rows for a select statement and also is sending data to the client.
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.
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 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. for show profile, this State means the thread is requesting the lock (not waiting for it ).
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 ).
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.
Writing to net
The server is writing a packet to the network.