title | summary |
---|---|
PROCESSLIST |
Learn the `PROCESSLIST` information_schema table. |
PROCESSLIST
, just like SHOW PROCESSLIST
, is used to view the requests that are being handled.
The PROCESSLIST
table has additional columns not present in SHOW PROCESSLIST
:
- A
DIGEST
column to show the digest of the SQL statement. - A
MEM
column to show the memory used by the request that is being processed, in bytes. - A
DISK
column to show the disk usage in bytes. - A
TxnStart
column to show the start time of the transaction. - A
RESOURCE_GROUP
column to show the resource group name.
{{< copyable "sql" >}}
USE information_schema;
DESC processlist;
+---------------------+---------------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+------+---------+-------+
| ID | bigint(21) unsigned | NO | | 0 | |
| USER | varchar(16) | NO | | | |
| HOST | varchar(64) | NO | | | |
| DB | varchar(64) | YES | | NULL | |
| COMMAND | varchar(16) | NO | | | |
| TIME | int(7) | NO | | 0 | |
| STATE | varchar(7) | YES | | NULL | |
| INFO | longtext | YES | | NULL | |
| DIGEST | varchar(64) | YES | | | |
| MEM | bigint(21) unsigned | YES | | NULL | |
| DISK | bigint(21) unsigned | YES | | NULL | |
| TxnStart | varchar(64) | NO | | | |
| RESOURCE_GROUP | varchar(32) | NO | | | |
+---------------------+---------------------+------+------+---------+-------+
13 rows in set (0.00 sec)
{{< copyable "sql" >}}
SELECT * FROM processlist\G
*************************** 1. row ***************************
ID: 2300033189772525975
USER: root
HOST: 127.0.0.1:51289
DB: NULL
COMMAND: Query
TIME: 0
STATE: autocommit
INFO: SELECT * FROM processlist
DIGEST: dbfaa16980ec628011029f0aaf0d160f4b040885240dfc567bf760d96d374f7e
MEM: 0
DISK: 0
TxnStart:
RESOURCE_GROUP: rg1
1 row in set (0.00 sec)
Fields in the PROCESSLIST
table are described as follows:
- ID: The ID of the user connection.
- USER: The name of the user who is executing
PROCESS
. - HOST: The address that the user is connecting to.
- DB: The name of the currently connected default database.
- COMMAND: The command type that
PROCESS
is executing. - TIME: The current execution duration of
PROCESS
, in seconds. - STATE: The current connection state.
- INFO: The requested statement that is being processed.
- DIGEST: The digest of the SQL statement.
- MEM: The memory used by the request that is being processed, in bytes.
- DISK: The disk usage in bytes.
- TxnStart: The start time of the transaction.
- RESOURCE_GROUP: The resource group name.
CLUSTER_PROCESSLIST
is the cluster system table corresponding to PROCESSLIST
. It is used to query the PROCESSLIST
information of all TiDB nodes in the cluster. The table schema of CLUSTER_PROCESSLIST
has one more column than PROCESSLIST
, the INSTANCE
column, which stores the address of the TiDB node this row of data is from.
{{< copyable "sql" >}}
SELECT * FROM information_schema.cluster_processlist;
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+
| INSTANCE | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | MEM | TxnStart | RESOURCE_GROUP |
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+
| 10.0.1.22:10080 | 150 | u1 | 10.0.1.1 | test | Query | 0 | autocommit | select count(*) from usertable | 372 | 05-28 03:54:21.230(416976223923077223) | default |
| 10.0.1.22:10080 | 138 | root | 10.0.1.1 | test | Query | 0 | autocommit | SELECT * FROM information_schema.cluster_processlist | 0 | 05-28 03:54:21.230(416976223923077220) | rg1 |
| 10.0.1.22:10080 | 151 | u1 | 10.0.1.1 | test | Query | 0 | autocommit | select count(*) from usertable | 372 | 05-28 03:54:21.230(416976223923077224) | rg2 |
| 10.0.1.21:10080 | 15 | u2 | 10.0.1.1 | test | Query | 0 | autocommit | select max(field0) from usertable | 496 | 05-28 03:54:21.230(416976223923077222) | default |
| 10.0.1.21:10080 | 14 | u2 | 10.0.1.1 | test | Query | 0 | autocommit | select max(field0) from usertable | 496 | 05-28 03:54:21.230(416976223923077225) | default |
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+