SHOW PROCESSLIST shows which threads are running 查看线程 解决瓶颈
小结:
1、查看全部线程;
https://dev.mysql.com/doc/refman/8.0/en/show-processlist.html
SHOW [FULL] PROCESSLIST
SHOW PROCESSLIST
shows which threads are running. If you have the PROCESS
privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MySQL account that you are using). If you do not use the FULL
keyword, only the first 100 characters of each statement are shown in the Info
field.
The SHOW PROCESSLIST
statement is very useful if you get the “too many connections” error message and want to find out what is going on. MySQL reserves one extra connection to be used by accounts that have the CONNECTION_ADMIN
or SUPER
privilege, to ensure that administrators should always be able to connect and check the system (assuming that you are not giving this privilege to all your users).
Threads can be killed with the KILL
statement. See Section 13.7.7.4, “KILL Syntax”.