<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="performance-schema-tp-thread-state-table">
      </a>
      29.12.16.4 The tp_thread_state Table
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045069698352">
  </a>
  <a class="indexterm" name="idm46045069696864">
  </a>
  <p>
   The
   <a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
    <code class="literal">
     tp_thread_state
    </code>
   </a>
   table has one
          row per thread created by the thread pool to handle
          connections.
  </p>
  <p>
   The
   <a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
    <code class="literal">
     tp_thread_state
    </code>
   </a>
   table has
          these columns:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       TP_GROUP_ID
      </code>
     </p>
     <p>
      The thread group ID.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TP_THREAD_NUMBER
      </code>
     </p>
     <p>
      The ID of the thread within its thread group.
      <code class="literal">
       TP_GROUP_ID
      </code>
      and
      <code class="literal">
       TP_THREAD_NUMBER
      </code>
      together provide a
              unique key within the table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       PROCESS_COUNT
      </code>
     </p>
     <p>
      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.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       WAIT_TYPE
      </code>
     </p>
     <p>
      The type of wait for the thread.
      <code class="literal">
       NULL
      </code>
      means the thread is not blocked. Otherwise, the thread is
              blocked by a call to
      <code class="literal">
       thd_wait_begin()
      </code>
      and the value specifies the type of wait. The
      <code class="literal">
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _WAIT
      </code>
      columns of the
      <a class="link" href="performance-schema-tp-thread-group-stats-table.html" title="29.12.16.3 The tp_thread_group_stats Table">
       <code class="literal">
        tp_thread_group_stats
       </code>
      </a>
      table
              accumulate counts for each wait type.
     </p>
     <p>
      The
      <code class="literal">
       WAIT_TYPE
      </code>
      value is a string that
              describes the type of wait, as shown in the following
              table.
     </p>
     <div class="table">
      <a name="idm46045069677168">
      </a>
      <p class="title">
       <b>
        Table 29.4 tp_thread_state Table WAIT_TYPE Values
       </b>
      </p>
      <div class="table-contents">
       <table summary="tp_thread_state table WAIT_TYPE values. The first column is the wait type. The second column describes the wait type.">
        <colgroup>
         <col style="width: 35%"/>
         <col style="width: 65%"/>
        </colgroup>
        <thead>
         <tr>
          <th>
           Wait Type
          </th>
          <th>
           Meaning
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_SLEEP
           </code>
          </td>
          <td>
           Waiting for sleep
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_DISKIO
           </code>
          </td>
          <td>
           Waiting for Disk IO
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_ROW_LOCK
           </code>
          </td>
          <td>
           Waiting for row lock
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_GLOBAL_LOCK
           </code>
          </td>
          <td>
           Waiting for global lock
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_META_DATA_LOCK
           </code>
          </td>
          <td>
           Waiting for metadata lock
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_TABLE_LOCK
           </code>
          </td>
          <td>
           Waiting for table lock
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_USER_LOCK
           </code>
          </td>
          <td>
           Waiting for user lock
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_BINLOG
           </code>
          </td>
          <td>
           Waiting for binlog
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_GROUP_COMMIT
           </code>
          </td>
          <td>
           Waiting for group commit
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            THD_WAIT_SYNC
           </code>
          </td>
          <td>
           Waiting for fsync
          </td>
         </tr>
        </tbody>
       </table>
      </div>
      <div class="table-contents">
       <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 431px; width: 555px;">
        <thead>
         <tr>
          <th style="width: 193.891px;">
           Wait Type
          </th>
          <th style="width: 360.078px;">
           Meaning
          </th>
         </tr>
        </thead>
       </table>
      </div>
     </div>
     <br class="table-break"/>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TP_THREAD_TYPE
      </code>
     </p>
     <p>
      The type of thread. The value shown in this column is one
              of
      <code class="literal">
       CONNECTION_HANDLER_WORKER_THREAD
      </code>
      ,
      <code class="literal">
       LISTENER_WORKER_THREAD
      </code>
      ,
      <code class="literal">
       QUERY_WORKER_THREAD
      </code>
      , or
      <code class="literal">
       TIMER_WORKER_THREAD
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       THREAD_ID
      </code>
     </p>
     <p>
      This thread's unique identifier. The value is the
              same as that used in the
      <code class="literal">
       THREAD_ID
      </code>
      column of the Performance Schema
      <a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
       <code class="literal">
        threads
       </code>
      </a>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TIME_OF_ATTACH
      </code>
      :
     </p>
     <p>
      Timestamp showing when the thread was attached, if
              attached to a connection; otherwise
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       MARKED_STALLED
      </code>
      :
     </p>
     <p>
      This is
      <code class="literal">
       True
      </code>
      if this thread has been
              marked as stalled by the stall checker thread.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       STATE
      </code>
      :
     </p>
     <p>
      Possible values depend on the type of thread, as shown by
              the
      <code class="literal">
       TP_THREAD_TYPE
      </code>
      column:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         For worker threads
                    (
         <code class="literal">
          QUERY_WORKER_THREAD
         </code>
         ), this is
                    one of
         <code class="literal">
          Managing
         </code>
         ,
         <code class="literal">
          Polling
         </code>
         ,
         <code class="literal">
          Processing
                    Direct
         </code>
         ,
         <code class="literal">
          Processing
                    Queued
         </code>
         ,
         <code class="literal">
          Sleeping
                    Consumer
         </code>
         , or
         <code class="literal">
          Sleeping
                    Reserve
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         For connection handler threads
                    (
         <code class="literal">
          CONNECTION_HANDLER_WORKER_THREAD
         </code>
         ),
                    this is one of
         <code class="literal">
          CH Processing
         </code>
         ,
         <code class="literal">
          CH Sleeping Timed
         </code>
         , or
         <code class="literal">
          CH
                    Sleeping Indefinite
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         For the stall checker thread
                    (
         <code class="literal">
          TIMER_WORKER_THREAD
         </code>
         ), this is
                    one of
         <code class="literal">
          SC Checking
         </code>
         ,
         <code class="literal">
          SC
                    Sleeping Short
         </code>
         , or
         <code class="literal">
          SC Sleeping
                    Long
         </code>
         .
        </p>
       </li>
      </ul>
     </div>
     <p>
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_COUNT
      </code>
      :
     </p>
     <p>
      The accumulated number of events processed by this thread.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ACCUMULATED_EVENT_TIME
      </code>
      :
     </p>
     <p>
      The wall clock time spent processing events.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EXEC_COUNT
      </code>
      :
     </p>
     <p>
      The accumulated number of queries (statements) passed to
              the server for execution.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ACCUMULATED_EXEC_TIME
      </code>
      :
     </p>
     <p>
      The wall clock time spent processing queries by the
              server.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The
   <a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
    <code class="literal">
     tp_thread_state
    </code>
   </a>
   table has one
          index; this is a unique index on the
   <code class="literal">
    TP_GROUP_ID
   </code>
   and
   <code class="literal">
    TP_THREAD_NUMBER
   </code>
   columns.
  </p>
  <p>
   <a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
    <code class="literal">
     TRUNCATE TABLE
    </code>
   </a>
   is not permitted
          for the
   <a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
    <code class="literal">
     tp_thread_state
    </code>
   </a>
   table.
  </p>
 </div>
 <br/>
</div>
