tencent cloud

TDSQL Boundless

PROCESSLIST

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-04-24 15:44:57

Function

The INFORMATION_SCHEMA.PROCESSLIST table is used to display the runtime status information of all current sessions (threads) within an instance. It can be used in scenarios such as viewing session connections, identifying slow queries, and troubleshooting long-running transactions.
This table extends the native MySQL PROCESSLIST table by adding fields such as TIME_MS, ROWS_SENT, ROWS_EXAMINED, and TID, providing more granular observability into session runtime behavior.
Note:
Users who are not granted the PROCESS privilege can only view information about their own sessions.
After the PROCESS privilege is granted, you can view information for all sessions within the instance.
You can obtain similar information using the SHOW PROCESSLIST or SHOW FULL PROCESSLIST statements. In these results, the INFO column is truncated to a maximum of 100 characters in SHOW PROCESSLIST, but is displayed in full in SHOW FULL PROCESSLIST and INFORMATION_SCHEMA.PROCESSLIST.

Field Description

Field Name
Type
Description
ID
bigint unsigned
The session connection ID, which corresponds to the return value of CONNECTION_ID(), can be used as a parameter for the KILL statement.
USER
varchar(32)
The MySQL username that initiated the session. System sessions are displayed as system user, and unauthenticated sessions are displayed as unauthenticated user.
HOST
varchar(261)
The hostname or IP address of the client that initiated the session, in the format host_name:port or ip:port.
DB
varchar(64)
The default database name currently used by the session. If no default database is selected, the value is NULL.
COMMAND
varchar(16)
The type of command being executed by the session. Common values include Sleep, Query, Connect, Binlog Dump, Killed, and so on.
TIME
int
The elapsed time of the current COMMAND, in seconds.
STATE
varchar(64)
The action, event, or state that the thread is currently performing, used to describe the execution stage the session is currently in. A value of NULL indicates no state information.
INFO
varchar(65535)
The SQL statement being executed by the session. If no statement is being executed, the value is NULL.
TIME_MS
bigint
The elapsed time of the current COMMAND, in milliseconds, providing higher-precision timing than the TIME field.
ROWS_SENT
bigint unsigned
The number of rows that the current statement of the session has returned to the client.
ROWS_EXAMINED
bigint unsigned
The number of rows that the current statement of the session has scanned, which can be used to help locate SQL statements with abnormal execution efficiency.
TID
bigint unsigned
The coroutine ID (that is, the bthread ID) corresponding to the session. If the session does not use a coroutine, the value is 0. It is used for troubleshooting thread-level issues on the system side.

Examples

Query all session information for the current instance:
tdsql> SELECT * FROM information_schema.PROCESSLIST\\G
*************************** 1. row ***************************
ID: 2155297
USER: test
HOST: 10.10.10.10:59078
DB: __tdsql_recycle_bin__
COMMAND: Query
TIME: 0
STATE: executing
INFO: SELECT * FROM `information_schema`.`PROCESSLIST`
TIME_MS: 2
ROWS_SENT: 0
ROWS_EXAMINED: 0
TID: 268435659
*************************** 2. row ***************************
ID: 2149066
USER: tdsql3_sys_local
HOST: localhost
DB: NULL
COMMAND: Sleep
TIME: 9
STATE: NULL
INFO: NULL
TIME_MS: 8726
ROWS_SENT: 4
ROWS_EXAMINED: 4
TID: 421765955
2 rows in set (0.01 sec)
Query sessions with an execution time greater than 10 seconds:
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO
FROM information_schema.PROCESSLIST
WHERE COMMAND <> 'Sleep' AND TIME > 10
ORDER BY TIME DESC;
Terminate a specified session by its ID:
KILL 2155297;

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan