<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="performance-schema-tp-thread-group-state-table">
      </a>
      29.12.16.2 The tp_thread_group_state Table
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045069841152">
  </a>
  <a class="indexterm" name="idm46045069839648">
  </a>
  <p>
   The
   <a class="link" href="performance-schema-tp-thread-group-state-table.html" title="29.12.16.2 The tp_thread_group_state Table">
    <code class="literal">
     tp_thread_group_state
    </code>
   </a>
   table
          has one row per thread group in the thread pool. Each row
          provides information about the current state of a group.
  </p>
  <p>
   The
   <a class="link" href="performance-schema-tp-thread-group-state-table.html" title="29.12.16.2 The tp_thread_group_state Table">
    <code class="literal">
     tp_thread_group_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. This is a unique key within the
              table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       CONSUMER THREADS
      </code>
     </p>
     <p>
      The number of consumer threads. There is at most one
              thread ready to start executing if the active threads
              become stalled or blocked.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       RESERVE_THREADS
      </code>
     </p>
     <p>
      The number of threads in the reserved state. This means
              that they are not started until there is a need to wake a
              new thread and there is no consumer thread. This is where
              most threads end up when the thread group has created more
              threads than needed for normal operation. Often a thread
              group needs additional threads for a short while and then
              does not need them again for a while. In this case, they
              go into the reserved state and remain until needed again.
              They take up some extra memory resources, but no extra
              computing resources.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       CONNECT_THREAD_COUNT
      </code>
     </p>
     <p>
      The number of threads that are processing or waiting to
              process connection initialization and authentication.
              There can be a maximum of four connection threads per
              thread group; these threads expire after a period of
              inactivity.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       CONNECTION_COUNT
      </code>
     </p>
     <p>
      The number of connections using this thread group.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       QUEUED_QUERIES
      </code>
     </p>
     <p>
      The number of statements waiting in the high-priority
              queue.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       QUEUED_TRANSACTIONS
      </code>
     </p>
     <p>
      The number of statements waiting in the low-priority
              queue. These are the initial statements for transactions
              that have not started, so they also represent queued
              transactions.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       STALL_LIMIT
      </code>
     </p>
     <p>
      The value of the
      <a class="link" href="server-system-variables.html#sysvar_thread_pool_stall_limit">
       <code class="literal">
        thread_pool_stall_limit
       </code>
      </a>
      system variable for the thread group. This is the same
              value for all thread groups.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       PRIO_KICKUP_TIMER
      </code>
     </p>
     <p>
      The value of the
      <a class="link" href="server-system-variables.html#sysvar_thread_pool_prio_kickup_timer">
       <code class="literal">
        thread_pool_prio_kickup_timer
       </code>
      </a>
      system variable for the thread group. This is the same
              value for all thread groups.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ALGORITHM
      </code>
     </p>
     <p>
      The value of the
      <a class="link" href="server-system-variables.html#sysvar_thread_pool_algorithm">
       <code class="literal">
        thread_pool_algorithm
       </code>
      </a>
      system variable for the thread group. This is the same
              value for all thread groups.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       THREAD_COUNT
      </code>
     </p>
     <p>
      The number of threads started in the thread pool as part
              of this thread group.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ACTIVE_THREAD_COUNT
      </code>
     </p>
     <p>
      The number of threads active in executing statements.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       STALLED_THREAD_COUNT
      </code>
     </p>
     <p>
      The number of stalled statements in the thread group. A
              stalled statement could be executing, but from a thread
              pool perspective it is stalled and making no progress. A
              long-running statement quickly ends up in this category.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       WAITING_THREAD_NUMBER
      </code>
     </p>
     <p>
      If there is a thread handling the polling of statements in
              the thread group, this specifies the thread number within
              this thread group. It is possible that this thread could
              be executing a statement.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       OLDEST_QUEUED
      </code>
     </p>
     <p>
      How long in milliseconds the oldest queued statement has
              been waiting for execution.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       MAX_THREAD_IDS_IN_GROUP
      </code>
     </p>
     <p>
      The maximum thread ID of the threads in the group. This is
              the same as
      <a class="link" href="aggregate-functions.html#function_max">
       <code class="literal">
        MAX(TP_THREAD_NUMBER)
       </code>
      </a>
      for
              the threads when selected from 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. That
              is, these two queries are equivalent:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20801702"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> TP_GROUP_ID<span class="token punctuation">,</span> MAX_THREAD_IDS_IN_GROUP
<span class="token keyword">FROM</span> tp_thread_group_state<span class="token punctuation">;</span>

<span class="token keyword">SELECT</span> TP_GROUP_ID<span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>TP_THREAD_NUMBER<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> tp_thread_state <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> TP_GROUP_ID<span class="token punctuation">;</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EFFECTIVE_MAX_TRANSACTIONS_LIMIT
      </code>
     </p>
     <p>
      The effective
      <code class="literal">
       max_transactions_limit_per_tg
      </code>
      value for
              the group.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       NUM_QUERY_THREADS
      </code>
     </p>
     <p>
      The number of worker threads in the group.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TIME_OF_LAST_THREAD_CREATION
      </code>
     </p>
     <p>
      The point in time when the thread was last created.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       NUM_CONNECT_HANDLER_THREAD_IN_SLEEP
      </code>
     </p>
     <p>
      The number of inactive connection handler threads.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       THREADS_BOUND_TO_TRANSACTION
      </code>
     </p>
     <p>
      The number of threads in an active transaction, which must
              be less than
      <code class="literal">
       thread_pool_max_transactions_limit
      </code>
      ;
              this is set only when
      <code class="literal">
       thread_pool_max_transactions_limit
      </code>
      is
              not
      <code class="literal">
       0
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       QUERY_THREADS_COUNT
      </code>
     </p>
     <p>
      same as num_query_threads, but used for different
              purposes?
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TIME_OF_EARLIEST_CON_EXPIRE
      </code>
     </p>
     <p>
      A timestamp showing the earliest point in time when a
              connection is expected to expire.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The
   <a class="link" href="performance-schema-tp-thread-group-state-table.html" title="29.12.16.2 The tp_thread_group_state Table">
    <code class="literal">
     tp_thread_group_state
    </code>
   </a>
   table
          has one index; this is a unique index on the
   <code class="literal">
    TP_GROUP_ID
   </code>
   column.
  </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-group-state-table.html" title="29.12.16.2 The tp_thread_group_state Table">
    <code class="literal">
     tp_thread_group_state
    </code>
   </a>
   table.
  </p>
 </div>
 <br/>
</div>
