W3cubDocs

/MariaDB

Performance Schema threads Table

Each server thread is represented as a row in the threads table.

The threads table contains the following columns:

Column Description Added
THREAD_ID A unique thread identifier. MariaDB 5.5
NAME Name associated with the server's thread instrumentation code, for example thread/sql/main for the server's main() function, and thread/sql/one_connection for a user connection. MariaDB 5.5
TYPE FOREGROUND or BACKGROUND, depending on the thread type. User connection threads are FOREGROUND, internal server threads are BACKGROUND. MariaDB 10.0
PROCESSLIST_ID The PROCESSLIST.ID value for threads displayed in the INFORMATION_SCHEMA.PROCESSLIST table, or 0 for background threads. Also corresponds with the CONNECTION_ID() return value for the thread. MariaDB 5.5
PROCESSLIST_USER Foreground thread user, or NULL for a background thread. MariaDB 10.0
PROCESSLIST_HOST Foreground thread host, or NULL for a background thread. MariaDB 10.0
PROCESSLIST_DB Thread's default database, or NULL if none exists. MariaDB 10.0
PROCESSLIST_COMMAND Type of command executed by the thread. These correspond to the the COM_xxx client/server protocol commands, and the Com_xxx status variables. See Thread Command Values. MariaDB 10.0
PROCESSLIST_TIME Time in seconds the thread has been in its current state. MariaDB 10.0
PROCESSLIST_STATE Action, event or state indicating what the thread is doing. MariaDB 10.0
PROCESSLIST_INFO Statement being executed by the thread, or NULL if a statement is not being executed. If a statement results in calling other statements, such as for a stored procedure, the innermost statement from the stored procedure is shown here. MariaDB 10.0
PARENT_THREAD_ID THREAD_ID of the parent thread, if any. Subthreads can for example be spawned as a result of INSERT DELAYED statements. MariaDB 10.0
ROLE Unused. MariaDB 10.0
INSTRUMENTED YES or NO for Whether the thread is instrumented or not. For foreground threads, the initial value is determined by whether there's a user/host match in the setup_actors table. Subthreads are again matched, while for background threads, this will be set to YES by default. To monitor events that the thread executes, INSTRUMENTED must be YES and the thread_instrumentation consumer in the setup_consumers table must also be YES. MariaDB 10.0

Example

SELECT * FROM performance_schema.threads\G;
*************************** 1. row ***************************
          THREAD_ID: 1
               NAME: thread/sql/main
               TYPE: BACKGROUND
     PROCESSLIST_ID: NULL
   PROCESSLIST_USER: NULL
   PROCESSLIST_HOST: NULL
     PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: NULL
   PROCESSLIST_TIME: 215859
  PROCESSLIST_STATE: Table lock
   PROCESSLIST_INFO: INTERNAL DDL LOG RECOVER IN PROGRESS
   PARENT_THREAD_ID: NULL
               ROLE: NULL
       INSTRUMENTED: YES
...
*************************** 21. row ***************************
          THREAD_ID: 64
               NAME: thread/sql/one_connection
               TYPE: FOREGROUND
     PROCESSLIST_ID: 44
   PROCESSLIST_USER: root
   PROCESSLIST_HOST: localhost
     PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: Query
   PROCESSLIST_TIME: 0
  PROCESSLIST_STATE: Sending data
   PROCESSLIST_INFO: SELECT * FROM performance_schema.threads
   PARENT_THREAD_ID: NULL
               ROLE: NULL
       INSTRUMENTED: YES

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/performance-schema-threads-table/