Documentation Home
MySQL 9.1 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.4Mb
PDF (A4) - 40.5Mb
Man Pages (TGZ) - 259.5Kb
Man Pages (Zip) - 366.7Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


29.12.16.4 The tp_thread_state Table

Thetp_thread_state table has one row per thread created by the thread pool to handle connections.

Thetp_thread_state table has these columns:

  • TP_GROUP_ID

    The thread group ID.

  • TP_THREAD_NUMBER

    The ID of the thread within its thread group.TP_GROUP_ID andTP_THREAD_NUMBER together provide a unique key within the table.

  • PROCESS_COUNT

    The 10ms interval in which the statement that uses this thread is currently executing. 0 means no statement is executing, 1 means it is in the first 10ms, and so forth.

  • WAIT_TYPE

    The type of wait for the thread.NULL means the thread is not blocked. Otherwise, the thread is blocked by a call tothd_wait_begin() and the value specifies the type of wait. Thexxx_WAIT columns of thetp_thread_group_stats table accumulate counts for each wait type.

    TheWAIT_TYPE value is a string that describes the type of wait, as shown in the following table.

    Table 29.4 tp_thread_state Table WAIT_TYPE Values

    Wait TypeMeaning
    THD_WAIT_SLEEPWaiting for sleep
    THD_WAIT_DISKIOWaiting for Disk IO
    THD_WAIT_ROW_LOCKWaiting for row lock
    THD_WAIT_GLOBAL_LOCKWaiting for global lock
    THD_WAIT_META_DATA_LOCKWaiting for metadata lock
    THD_WAIT_TABLE_LOCKWaiting for table lock
    THD_WAIT_USER_LOCKWaiting for user lock
    THD_WAIT_BINLOGWaiting for binlog
    THD_WAIT_GROUP_COMMITWaiting for group commit
    THD_WAIT_SYNCWaiting for fsync

  • TP_THREAD_TYPE

    The type of thread. The value shown in this column is one ofCONNECTION_HANDLER_WORKER_THREAD,LISTENER_WORKER_THREAD,QUERY_WORKER_THREAD, orTIMER_WORKER_THREAD.

  • THREAD_ID

    This thread's unique identifier. The value is the same as that used in theTHREAD_ID column of the Performance Schemathreads table.

  • TIME_OF_ATTACH:

    Timestamp showing when the thread was attached, if attached to a connection; otherwiseNULL.

  • MARKED_STALLED:

    This isTrue if this thread has been marked as stalled by the stall checker thread.

  • STATE:

    Possible values depend on the type of thread, as shown by theTP_THREAD_TYPE column:

    • For worker threads (QUERY_WORKER_THREAD), this is one ofManaging,Polling,Processing Direct,Processing Queued,Sleeping Consumer, orSleeping Reserve.

    • For connection handler threads (CONNECTION_HANDLER_WORKER_THREAD), this is one ofCH Processing,CH Sleeping Timed, orCH Sleeping Indefinite.

    • For the stall checker thread (TIMER_WORKER_THREAD), this is one ofSC Checking,SC Sleeping Short, orSC Sleeping Long.

  • EVENT_COUNT:

    The accumulated number of events processed by this thread.

  • ACCUMULATED_EVENT_TIME:

    The wall clock time spent processing events.

  • EXEC_COUNT:

    The accumulated number of queries (statements) passed to the server for execution.

  • ACCUMULATED_EXEC_TIME:

    The wall clock time spent processing queries by the server.

Thetp_thread_state table has one index; this is a unique index on theTP_GROUP_ID andTP_THREAD_NUMBER columns.

TRUNCATE TABLE is not permitted for thetp_thread_state table.