MySQL 8.4 Reference Manual Including MySQL NDB Cluster 8.4

29.12.22.7 The processlist Table

The MySQL process list indicates the operations currently being performed by the set of threads executing within the server. The processlist table is one source of process information. For a comparison of this table with other sources, see Sources of Process Information.

The processlist table can be queried directly. If you have the PROCESS privilege, you can see all threads, even those belonging to other users. Otherwise (without the PROCESS privilege), nonanonymous users have access to information about their own threads but not threads for other users, and anonymous users have no access to thread information.

Note

If the performance_schema_show_processlist system variable is enabled, the processlist table also serves as the basis for an alternative implementation underlying the SHOW PROCESSLIST statement. For details, see later in this section.

The processlist table contains a row for each server process:

mysql> SELECT * FROM performance_schema.processlist\G
*************************** 1. row ***************************
     ID: 5
   USER: event_scheduler
   HOST: localhost
     DB: NULL
COMMAND: Daemon
   TIME: 137
  STATE: Waiting on empty queue
   INFO: NULL
*************************** 2. row ***************************
     ID: 9
   USER: me
   HOST: localhost:58812
     DB: NULL
COMMAND: Sleep
   TIME: 95
  STATE:
   INFO: NULL
*************************** 3. row ***************************
     ID: 10
   USER: me
   HOST: localhost:58834
     DB: test
COMMAND: Query
   TIME: 0
  STATE: executing
   INFO: SELECT * FROM performance_schema.processlist
...

The processlist table has these columns:

The processlist table has these indexes:

TRUNCATE TABLE is not permitted for the processlist table.

As mentioned previously, if the performance_schema_show_processlist system variable is enabled, the processlist table serves as the basis for an alternative implementation of other process information sources:

The default SHOW PROCESSLIST implementation iterates across active threads from within the thread manager while holding a global mutex. This has negative performance consequences, particularly on busy systems. The alternative SHOW PROCESSLIST implementation is based on the Performance Schema processlist table. This implementation queries active thread data from the Performance Schema rather than the thread manager and does not require a mutex.

MySQL configuration affects processlist table contents as follows:

The preceding configuration parameters affect the contents of the processlist table. For a given configuration, however, the processlist contents are unaffected by the performance_schema_show_processlist setting.

The alternative process list implementation does not apply to the INFORMATION_SCHEMA PROCESSLIST table or the COM_PROCESS_INFO command of the MySQL client/server protocol.