Related Documentation Download this Excerpt
PDF (US Ltr) - 269.1Kb
PDF (A4) - 270.5Kb
HTML Download (TGZ) - 52.3Kb
HTML Download (Zip) - 70.6Kb

10.6.2 The threads Table

The threads table contains a row for each server thread:

mysql> SELECT * FROM performance_schema.threads;
| THREAD_ID | PROCESSLIST_ID | NAME                                   |
|         0 |              0 | thread/sql/main                        |
|         1 |              0 | thread/innodb/io_handler_thread        |
|        16 |              0 | thread/sql/signal_handler              |
|        23 |              7 | thread/sql/one_connection              |
|         5 |              0 | thread/innodb/io_handler_thread        |
|        12 |              0 | thread/innodb/srv_lock_timeout_thread  |
|        22 |              6 | thread/sql/one_connection              |

For INFORMATION_SCHEMA.PROCESSLIST and SHOW PROCESSLIST, information about threads for other users is shown only if the current user has the PROCESS privilege. That is not true of the threads table; all rows are shown to any user who has the SELECT privilege for the table. Users who should not be able to see threads for other users should not be given that privilege.

The threads table has these columns:


    This is the unique identifier of an instrumented thread.


    For threads that are displayed in the INFORMATION_SCHEMA.PROCESSLIST table, this is the same value displayed in the ID column of that table. It is also the value displayed in the Id column of SHOW PROCESSLIST output, and the value that CONNECTION_ID() would return within that thread.

    For background threads (threads not associated with a user connection), PROCESSLIST_ID is 0, so the values are not unique.

  • NAME

    NAME is the name associated with the instrumentation of the code in the server. For example, thread/sql/one_connection corresponds to the thread function in the code responsible for handling a user connection, and thread/sql/main stands for the main() function of the server.

TRUNCATE TABLE is not permitted for the threads table.