<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="performance-schema-wait-summary-tables">
      </a>
      29.12.20.1 Wait Event Summary Tables
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045069146480">
  </a>
  <a class="indexterm" name="idm46045069144960">
  </a>
  <a class="indexterm" name="idm46045069143440">
  </a>
  <a class="indexterm" name="idm46045069141920">
  </a>
  <a class="indexterm" name="idm46045069140400">
  </a>
  <a class="indexterm" name="idm46045069138896">
  </a>
  <a class="indexterm" name="idm46045069137392">
  </a>
  <a class="indexterm" name="idm46045069135872">
  </a>
  <a class="indexterm" name="idm46045069134352">
  </a>
  <a class="indexterm" name="idm46045069132832">
  </a>
  <a class="indexterm" name="idm46045069131312">
  </a>
  <a class="indexterm" name="idm46045069129792">
  </a>
  <p>
   The Performance Schema maintains tables for collecting current
          and recent wait events, and aggregates that information in
          summary tables.
   <a class="xref" href="performance-schema-wait-tables.html" title="29.12.4 Performance Schema Wait Event Tables">
    Section 29.12.4, “Performance Schema Wait Event Tables”
   </a>
   describes the
          events on which wait summaries are based. See that discussion
          for information about the content of wait events, the current
          and recent wait event tables, and how to control wait event
          collection, which is disabled by default.
  </p>
  <p>
   Example wait event summary information:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35857897"><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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span>
       <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_waits_summary_global_by_event_name\G
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 6. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
    EVENT_NAME<span class="token punctuation">:</span> wait/synch/mutex/sql/BINARY_LOG<span class="token punctuation">:</span><span class="token punctuation">:</span>LOCK_index
    COUNT_STAR<span class="token punctuation">:</span> 8
SUM_TIMER_WAIT<span class="token punctuation">:</span> 2119302
MIN_TIMER_WAIT<span class="token punctuation">:</span> 196092
AVG_TIMER_WAIT<span class="token punctuation">:</span> 264912
MAX_TIMER_WAIT<span class="token punctuation">:</span> 569421
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 9. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
    EVENT_NAME<span class="token punctuation">:</span> wait/synch/mutex/sql/hash_filo<span class="token punctuation">:</span><span class="token punctuation">:</span>lock
    COUNT_STAR<span class="token punctuation">:</span> 69
SUM_TIMER_WAIT<span class="token punctuation">:</span> 16848828
MIN_TIMER_WAIT<span class="token punctuation">:</span> 0
AVG_TIMER_WAIT<span class="token punctuation">:</span> 244185
MAX_TIMER_WAIT<span class="token punctuation">:</span> 735345
...</span></code></pre>
  </div>
  <p>
   Each wait event summary table has one or more grouping columns
          to indicate how the table aggregates events. Event names refer
          to names of event instruments in the
   <a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
    <code class="literal">
     setup_instruments
    </code>
   </a>
   table:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
       <code class="literal">
        events_waits_summary_by_account_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       EVENT_NAME
      </code>
      ,
      <code class="literal">
       USER
      </code>
      , and
      <code class="literal">
       HOST
      </code>
      columns. Each row summarizes events for a given account
              (user and host combination) and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
       <code class="literal">
        events_waits_summary_by_host_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       EVENT_NAME
      </code>
      and
      <code class="literal">
       HOST
      </code>
      columns. Each row summarizes
              events for a given host and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       <code class="literal">
        events_waits_summary_by_instance
       </code>
      </a>
      has
      <code class="literal">
       EVENT_NAME
      </code>
      and
      <code class="literal">
       OBJECT_INSTANCE_BEGIN
      </code>
      columns. Each row
              summarizes events for a given event name and object. If an
              instrument is used to create multiple instances, each
              instance has a unique
      <code class="literal">
       OBJECT_INSTANCE_BEGIN
      </code>
      value and is
              summarized separately in this table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       <code class="literal">
        events_waits_summary_by_thread_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       THREAD_ID
      </code>
      and
      <code class="literal">
       EVENT_NAME
      </code>
      columns. Each row summarizes
              events for a given thread and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
       <code class="literal">
        events_waits_summary_by_user_by_event_name
       </code>
      </a>
      has
      <code class="literal">
       EVENT_NAME
      </code>
      and
      <code class="literal">
       USER
      </code>
      columns. Each row summarizes
              events for a given user and event name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       <code class="literal">
        events_waits_summary_global_by_event_name
       </code>
      </a>
      has an
      <code class="literal">
       EVENT_NAME
      </code>
      column. Each row
              summarizes events for a given event name. An instrument
              might be used to create multiple instances of the
              instrumented object. For example, if there is an
              instrument for a mutex that is created for each
              connection, there are as many instances as there are
              connections. The summary row for the instrument summarizes
              over all these instances.
     </p>
    </li>
   </ul>
  </div>
  <p>
   Each wait event summary table has these summary columns
          containing aggregated values:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       COUNT_STAR
      </code>
     </p>
     <p>
      The number of summarized events. This value includes all
              events, whether timed or nontimed.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       SUM_TIMER_WAIT
      </code>
     </p>
     <p>
      The total wait time of the summarized timed events. This
              value is calculated only for timed events because nontimed
              events have a wait time of
      <code class="literal">
       NULL
      </code>
      . The
              same is true for the other
      <code class="literal">
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _TIMER_WAIT
      </code>
      values.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       MIN_TIMER_WAIT
      </code>
     </p>
     <p>
      The minimum wait time of the summarized timed events.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       AVG_TIMER_WAIT
      </code>
     </p>
     <p>
      The average wait time of the summarized timed events.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       MAX_TIMER_WAIT
      </code>
     </p>
     <p>
      The maximum wait time of the summarized timed events.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The wait event summary tables have these indexes:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
       <code class="literal">
        events_waits_summary_by_account_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          USER
         </code>
         ,
         <code class="literal">
          HOST
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
       <code class="literal">
        events_waits_summary_by_host_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          HOST
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       <code class="literal">
        events_waits_summary_by_instance
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on
                  (
         <code class="literal">
          OBJECT_INSTANCE_BEGIN
         </code>
         )
        </p>
       </li>
       <li class="listitem">
        <p>
         Index on (
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       <code class="literal">
        events_waits_summary_by_thread_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          THREAD_ID
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
       <code class="literal">
        events_waits_summary_by_user_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          USER
         </code>
         ,
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
       <code class="literal">
        events_waits_summary_global_by_event_name
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Primary key on (
         <code class="literal">
          EVENT_NAME
         </code>
         )
        </p>
       </li>
      </ul>
     </div>
    </li>
   </ul>
  </div>
  <p>
   <a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
    <code class="literal">
     TRUNCATE TABLE
    </code>
   </a>
   is permitted for
          wait summary tables. It has these effects:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      For summary tables not aggregated by account, host, or
              user, truncation resets the summary columns to zero rather
              than removing rows.
     </p>
    </li>
    <li class="listitem">
     <p>
      For summary tables aggregated by account, host, or user,
              truncation removes rows for accounts, hosts, or users with
              no connections, and resets the summary columns to zero for
              the remaining rows.
     </p>
    </li>
   </ul>
  </div>
  <p>
   In addition, each wait summary table that is aggregated by
          account, host, user, or thread is implicitly truncated by
          truncation of the connection table on which it depends, or
          truncation of
   <a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
    <code class="literal">
     events_waits_summary_global_by_event_name
    </code>
   </a>
   .
          For details, see
   <a class="xref" href="performance-schema-connection-tables.html" title="29.12.8 Performance Schema Connection Tables">
    Section 29.12.8, “Performance Schema Connection Tables”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
