SHOW PROCESSLIST
This topic describes how to execute the SHOW PROCESSLIST and SHOW PHYSICAL_PROCESSLIST statements.
SHOW PROCESSLIST
You can execute the following statement to view connections in PolarDB-X and SQL statements that are being executed.
Syntax
SHOW PROCESSLIST
Examples
SHOW PROCESSLIST\G ID: 1971050 USER: admin HOST: 111.111.111.111:4303 DB: drds_test COMMAND: Query TIME: 0 STATE: INFO: show processlist 1 row in set (0.01 sec)
| Parameter | Description | |---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ID | The ID of the connection. The value is a number of the LONG data type. | | USER | The username used to establish the connection. | | HOST | The IP address and port number of the host for which the connection is established. | | DB | The name of the database accessed over the connection. | | COMMAND | Valid values:
- Query: The connection has an SQL statement that is being executed.
- Sleep: The connection is idle.
- If the value of the COMMAND parameter is Query, the TIME parameter indicates how long the SQL statement is executed over the connection.
- If the value of the COMMAND parameter is Sleep, the TIME parameter indicates how long the connection remains idle.
- If the value of the COMMAND parameter is Query, the INFO parameter indicates the content of the SQL statement that is being executed over the connection.
**Note** If the statement excludes the FULL keyword, only the first 30 characters of the SQL statement that is being executed are returned. If the statement includes the FULL keyword, only the first 1,000 characters of the SQL statement that is being executed are returned. - If the value of the COMMAND parameter is Sleep, the INFO parameter is meaningless and is empty.
SHOW PHYSICAL_PROCESSLIST
You can execute the following statement to view information about all physical SQL statements that are being executed.
Syntax
SHOW PHYSICAL_PROCESSLIST
Note If an SQL statement is excessively long, the SQL statement is truncated in the results returned by the SHOW PHYSICAL_PROCESSLIST
statement. You can execute the SHOW FULL PHYSICAL_PROCESSLIST
statement to query the complete SQL statement.
Examples
SHOW PHYSICAL_PROCESSLIST\G *************************** 1. row *************************** ID: 0-0-521414 USER: tddl5 DB: tddl5_00 COMMAND: Query TIME: 0 STATE: init INFO: show processlist *************************** 2. row *************************** ID: 0-0-521570 USER: tddl5 DB: tddl5_00 COMMAND: Query TIME: 0 STATE: User sleep INFO: /*DRDS /88.88.88.88/b67a0e4d8800000/ */ select sleep(1000) 2 rows in set (0.01 sec)
Note
The meaning of each column in the returned results is equivalent to that in the result returned by the
SHOW PROCESSLIST
statement in MySQL. For more information, see SHOW PROCESSLIST syntax.MySQL returns a number in the ID column for a physical connection, but a PolarDB-X instance returns a string in the ID column for a physical connection.