When you are attempting to ascertain what your MySQL server is doing, it can be helpful to examine the process list, which is the set of threads currently executing within the server. Process list information is available from these sources:
SHOW [FULL] PROCESSLISTstatement: Section 184.108.40.206, “SHOW PROCESSLIST Syntax”
PROCESSLISTtable: Section 24.17, “The INFORMATION_SCHEMA PROCESSLIST Table”
The Performance Schema
threadstable, stage tables, and lock tables: Section 25.11.17, “Performance Schema Miscellaneous Tables”, Section 25.11.5, “Performance Schema Stage Event Tables”, Section 25.11.12, “Performance Schema Lock Tables”.
threads does not require a
mutex and has minimal impact on server performance.
SHOW PROCESSLIST have negative
performance consequences because they require a mutex.
threads also shows information about
background threads, which
SHOW PROCESSLIST do not. This means
threads can be used to monitor
activity the other thread information sources cannot.
You can always view information about your own threads. To view
information about threads being executed for other accounts, you
must have the
Each process list entry contains several pieces of information:
Idis the connection identifier for the client associated with the thread.
Hostindicate the account associated with the thread.
dbis the default database for the thread, or
NULLif none is selected.
Stateindicate what the thread is doing.
Most states correspond to very quick operations. If a thread stays in a given state for many seconds, there might be a problem that needs to be investigated.
Timeindicates how long the thread has been in its current state. The thread's notion of the current time may be altered in some cases: The thread can change the time with
SET TIMESTAMP =. For a thread running on a slave that is processing events from the master, the thread time is set to the time found in the events and thus reflects current time on the master and not the slave.
Infocontains the text of the statement being executed by the thread, or
NULLif it is not executing one. By default, this value contains only the first 100 characters of the statement. To see the complete statements, use
SHOW FULL PROCESSLIST.
processlistview, which presents information from the Performance Schema
threadstable in a more accessible format: Section 220.127.116.11, “The processlist and x$processlist Views”
sessionview, which presents information about user sessions (like the
processlistview, but with background processes filtered out): Section 18.104.22.168, “The session and x$session Views”
The following sections list the possible
Command values, and
values grouped by category. The meaning for some of these values
is self-evident. For others, additional description is provided.