Mysqladmin processlist; Show Processlist; Show status;

Source: Internet
Author: User
Tags first row mysql view

Mysqladmin showprocesslist can view full SQL requires permissions.

Show Processlist shows which threads are running. You can also use the Mysqladmin processlist statement to get this information . If you have super privileges, you can see all the threads. Otherwise, you can only see 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 host name of the TCP/IP connection (in host_name:client_port format) to easily determine which client is doing what.

This statement is useful if you get the "Too many connections" error message and want to know what is happening. MySQL keeps an extra connection for an account with super privileges to ensure that the administrator is able to connect and check the system at any time (assuming you do not give this permission to all users).

[Plain]View PlainCopy print?
  1. Mysql> Show full processlist;
  2. +---------+-------------+--------------------+----------------+-------------+-------+-------------------------- ---------------------------------------------+-----------------------+
  3. | id      | user         | Host                | db             | command      | Time  | State                                                                     | Info                   |  
  4. +---------+-------------+--------------------+----------------+-------------+-------+-------------------------- ---------------------------------------------+-----------------------+
  5. | 1056536 | Replication | 192.168.6.91:38417 | NULL | Binlog Dump | 33759 | Master has sent all binlog to slave; Waiting for Binlog to be updated | NULL |
  6. | 1107067 | miaohr      | 192.168.6.81:32024 |  NULL           | Query        |     0 | NULL                                                                      | show full processlist |  
  7. | 1107182 | miaohr      | 192.168.6.91:44217  | hr_db_business | Sleep       |      1 |                                                                           | NULL                   |  
  8. +---------+-------------+--------------------+----------------+-------------+-------+-------------------------- ---------------------------------------------+-----------------------+



The most critical of this command is the State column, which is listed in the following categories:

Checking table
Checking the data table (this is automatic).
Closing tables
The modified data in the table is being flushed to disk, and the tables that have been exhausted are being closed. This is a quick operation, and if not, you should confirm that the disk space is full or that the disk is under heavy load.
Connect out
Replication from the server is connecting to the primary 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 temporary tables to hold partial query results.
deleting from Main Table
The server is performing the first part of a multi-table delete and has just deleted the first table.
deleting from reference tables
The server is performing the second part of a multi-table delete and is deleting records from other tables.
Flushing tables
Executing flush TABLES, waiting for other threads to close the data table.
Killed
Sends a KILL request to a thread, the thread checks the kill flag bit and discards the next kill request. MySQL checks the kill flag bit in each of the main loops, but in some cases the thread may die in a short period of time. If the line regulation regulation is locked by another thread, the kill request will take effect as soon as the lock is released.
Locked
Locked by another query.
Sending data
The record for the select query is being processed, and the results are being sent to the client.
Sorting for group
Sorting is being done for group by.
Sorting for order
The order by is being sorted.
Opening tables
The process should be quick, unless other factors interfere with it. For example, a data table cannot be opened by another thread until the row of the ALTER TABLE or LOCK TABLE statement is complete. Attempting to open a table.
removing duplicates
A query that is executing a SELECT distinct method is being executed, but MySQL cannot optimize those duplicate records in the previous phase. Therefore, MySQL needs to remove the duplicate records again, and then send the results to the client.
Reopen table
A lock on a table is obtained, but it must be changed after the table structure has been modified. The lock has been released, the data table is closed, and the data table is being tried again.
Repair by sorting
Repair instructions are being sorted to create an index.
Repair with Keycache
The repair instructions are using the index cache to create a new index one by one. It will be slower than repair by sorting.
Searching rows for update
The qualifying records are being told to find out to prepare for the update. It must be completed before the update is about to modify the related records.
Sleeping
Waiting for the client to send a new request.
System Lock
Is waiting to get an external system lock. If you are not currently running multiple mysqld servers requesting the same table at the same time, you can suppress the external system lock by increasing the--skip-external-locking parameter.
Upgrading lock
Insert delayed is trying to get a lock table to insert a new record.
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 a new structure. Then, to be able to reopen the data table, you 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 insertions and is waiting for a new request.
Most of the state corresponds to a fast operation, so long as one thread remains in the same state for several seconds, a problem may occur and need to be checked.
There are other states that are not listed above, but most of them are only useful to see if there is an error in the server.

MySQL view current number of connections

Command: Show Processlist;
If it is the root account, you can see the current connection for all users. If you are a normal account, you can only see the connection you are occupying.
Show Processlist; only the first 100 are listed, please use show full processlist if you want to list them all.

Command: Show status;
Aborted_clients the number of connections that have been discarded because the client did not properly close the connection already dead.
Aborted_connects the number of times the connection to the MySQL server has failed.
Connections the number of attempts to connect to the MySQL server.
Created_tmp_tables the number of suppressed temporary tables that have been created when the statement is executed.
Delayed_insert_threads the number of deferred plug-in processor threads being used.
Delayed_writes the number of rows written with the insert Delayed.
Delayed_errors the number of rows written with insert Delayed for some errors (possibly repeating key values).
Flush_commands the number of times the flush command was executed.
Handler_delete the number of times a row was requested to be deleted from a table.
The number of times the Handler_read_first request reads the first row in the table.
The Handler_read_key requests a number based on the key read line.
The number of times a handler_read_next request reads into a row based on one key.
The number of times a HANDLER_READ_RND request reads into a row based on a fixed position.
Handler_update the number of times a row in the table was requested to be updated.
The number of times the Handler_write request inserts a row into the table.
key_blocks_used the number of blocks used for the keyword cache.
Key_read_requests the number of times a key value was requested to be read from the cache.
Key_reads the number of times a key value has been physically read from disk.
Key_write_requests requests a keyword block to be written to the cache count.
Key_writes the number of times a key-value block is physically written to disk.
Max_used_connections the maximum number of connections that are used at the same time.
Not_flushed_key_blocks a key block that has been changed in the key cache but has not been emptied to disk.
Not_flushed_delayed_rows the number of rows waiting to be written in the Insert delay queue.
Open_tables the number of open tables.
Open_files the number of open files.
Open_streams Number of open streams (primarily for log records)
Opened_tables the number of tables that have been opened.
Questions the number of queries destined for the server.
Slow_queries the number of queries that will take more than long_query_time time.
threads_connected the number of connections currently open.
Threads_running the number of threads that are not sleeping.

Uptime How many seconds the server has worked.

To view configuration parameters:

SHOW VARIABLES like '%timeout% '

Mysqladmin processlist; Show Processlist; Show status;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.