MySQL Show Processlist Description

Source: Internet
Author: User

Show Processlist and show full processlist

The output of the Processlist command shows which threads are running, not only the current number of connections, but also the current connection status to help identify problematic query statements.

If it is the root account, you can see the current connection for all users. If it is a different normal account, you can only see the connections that you occupy. Showprocesslist can only list the current 100 articles. If you want to list them all, you can use the show full Processlist command

mysql> show processlist;+----+------+--------------------+------+---------+-------+-------+------ ------------+| id | user | host                | db   | command | time  |  state | info             |+-- --+------+--------------------+------+---------+-------+-------+------------------+|  1 |  root | localhost          | null |  Sleep   |    12 |       | null              | |   2 | root | 192.168.100.1:7437 | test | Sleep    |  8035 |       | null              | |   3 | root | 192.168.100.1:7438 | NULL | Sleep    | 24348 |       | NULL              | |   5 | root | 192.168.100.1:7443 | NULL | Sleep    | 24317 |       | NULL              | |   7 | root | 192.168.100.1:7450 | test | Sleep    | 24272 |       | NULL              | |   9 | root | 192.168.100.1:5152 | test | query   |     0 | init  | show  processlist |+----+------+--------------------+------+---------+-------+-------+------------------+6  rows in setmysql> show full processlist;+----+------+--------------------+-- ----+---------+-------+-------+-----------------------+| id | user | host                | db   |  Command | Time  | State | Info                   |+----+------+--------------------+--- ---+---------+-------+-------+-----------------------+|  1 | root | localhost           | null | sleep   |     19 |       | null                   | |   2 | root | 192.168.100.1:7437 | test | Sleep    |  8042 |       | NULL                   | |   3 | root | 192.168.100.1:7438 | NULL | Sleep    | 24355 |       | NULL                   | |   5 | root | 192.168.100.1:7443 | NULL | Sleep    | 24324 |       | NULL                   | |   7 | root | 192.168.100.1:7450 | test | Sleep    | 24279 |       | NULL                   | |   9 | root | 192.168.100.1:5152 | test | Query    |     0 | init  | show full processlist  |+----+------+--------------------+------+---------+-------+-------+-----------------------+6 rows  in set

The meaning of each column:

①.id column, when a user logs on to MySQL, the system assigns "connection_id", which can be viewed using the function connection_id ()
The ②.user column that displays the current user. If it is not root, this command displays only the SQL statements for the user's permission range
The ③.host column, which shows which IP port this statement was sent from, can be used to track the user who has the problem statement
The ④.db column that shows which database the process is currently connected to
The ⑤.command column, which displays the execution commands for the current connection, typically sleeps (sleep), queries (query), connection (connect), etc.
⑥.time column that shows the duration of this state, in seconds
The ⑦.state column, which displays the status of the SQL statement using the current connection, is an important column. State describes one of the states in a statement execution. An SQL statement, for example, may need to be copying to TMP table, sorting result, sending data, etc.
The ⑧.info column, which displays this SQL statement, is an important basis for judging the problem statement.

In a master-slave replication environment, show processlist or show full processlist is useful for judging states, such as the following State column:

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/09/bd43df8caf98f12831cf049e590fcf37.png "style=" float: none; "title=" 171029084732801.png "alt=" Bd43df8caf98f12831cf049e590fcf37.png "/>


650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/09/f82a40b0fb33ed8bf5b28e659e8a466f.png "style=" float: none; "title=" 171029084732802.png "alt=" F82a40b0fb33ed8bf5b28e659e8a466f.png "/>


MySQL Show Processlist Description

Related Article

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.