The threads table contains a row
for each server thread:
mysql> SELECT * FROM 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 |
...
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).
The threads table has these
columns:
THREAD_ID
This is the unique identifier of an instrumented thread.
PROCESSLIST_ID
For threads that are displayed in
INFORMATION_SCHEMA.PROCESSLIST,
this is the INFORMATION_SCHEMA.ID
value, which is also 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.
This column was named ID before MySQL
5.5.8.
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.
The threads table was named
PROCESSLIST before MySQL 5.5.6.

User Comments
Add your own comment.