PROCESSLIST

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.
  1. USE information_schema;
  2. DESC processlist;
  1. +---------------------+---------------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +---------------------+---------------------+------+------+---------+-------+
  4. | ID | bigint(21) unsigned | NO | | 0 | |
  5. | USER | varchar(16) | NO | | | |
  6. | HOST | varchar(64) | NO | | | |
  7. | DB | varchar(64) | YES | | NULL | |
  8. | COMMAND | varchar(16) | NO | | | |
  9. | TIME | int(7) | NO | | 0 | |
  10. | STATE | varchar(7) | YES | | NULL | |
  11. | INFO | longtext | YES | | NULL | |
  12. | DIGEST | varchar(64) | YES | | | |
  13. | MEM | bigint(21) unsigned | YES | | NULL | |
  14. | DISK | bigint(21) unsigned | YES | | NULL | |
  15. | TxnStart | varchar(64) | NO | | | |
  16. | RESOURCE_GROUP | varchar(32) | NO | | | |
  17. +---------------------+---------------------+------+------+---------+-------+
  18. 13 rows in set (0.00 sec)
  1. SELECT * FROM processlist\G
  1. *************************** 1. row ***************************
  2. ID: 2300033189772525975
  3. USER: root
  4. HOST: 127.0.0.1:51289
  5. DB: NULL
  6. COMMAND: Query
  7. TIME: 0
  8. STATE: autocommit
  9. INFO: SELECT * FROM processlist
  10. DIGEST: dbfaa16980ec628011029f0aaf0d160f4b040885240dfc567bf760d96d374f7e
  11. MEM: 0
  12. DISK: 0
  13. TxnStart:
  14. RESOURCE_GROUP: rg1
  15. 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

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.

  1. SELECT * FROM information_schema.cluster_processlist;
  1. +-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+
  2. | INSTANCE | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | MEM | TxnStart | RESOURCE_GROUP |
  3. +-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+
  4. | 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 |
  5. | 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 |
  6. | 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 |
  7. | 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 |
  8. | 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 |
  9. +-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+