进程列表
The PROCESSLIST table provides information about which threads are running.
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
|---|---|---|
ID | Id | MySQL extension |
USER | User | MySQL extension |
HOST | Host | MySQL extension |
DB | db | MySQL extension |
COMMAND | Command | MySQL extension |
TIME | Time | MySQL extension |
STATE | State | MySQL extension |
INFO | Info | MySQL extension |
For an extensive description of the table columns, see Section 13.7.5.29, “SHOW PROCESSLIST Syntax”.
Notes:
-
The
PROCESSLISTtable is a nonstandard table. -
Like the output from the corresponding
SHOWstatement, thePROCESSLISTtable will only show information about your own threads, unless you have thePROCESSprivilege, in which case you will see information about other threads, too. As an anonymous user, you cannot see any rows at all. -
If an SQL statement refers to
INFORMATION_SCHEMA.PROCESSLIST, MySQL populates the entire table once, when statement execution begins, so there is read consistency during the statement. There is no read consistency for a multi-statement transaction, though. -
Process information is also available from the
performance_schema.threadstable. However, access tothreadsdoes not require a mutex and has minimal impact on server performance.INFORMATION_SCHEMA.PROCESSLISTandSHOW PROCESSLISThave negative performance consequences because they require a mutex.threadsalso shows information about background threads, whichINFORMATION_SCHEMA.PROCESSLISTandSHOW PROCESSLISTdo not. This means thatthreadscan be used to monitor activity the other thread information sources cannot.
The following statements are equivalent:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
SHOW FULL PROCESSLIST
本文详细介绍了 MySQL 中 PROCESSLIST 表的功能及使用方法,包括如何通过 INFORMATION_SCHEMA 和 SHOW PROCESSLIST 命令获取当前运行线程的信息,并对比了不同方法对服务器性能的影响。
1081

被折叠的 条评论
为什么被折叠?



