<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="monitor-innodb-mutex-waits-performance-schema">
      </a>
      17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045149542320">
  </a>
  <a class="indexterm" name="idm46045149540832">
  </a>
  <p>
   A mutex is a synchronization mechanism used in the code to enforce
      that only one thread at a given time can have access to a common
      resource. When two or more threads executing in the server need to
      access the same resource, the threads compete against each other.
      The first thread to obtain a lock on the mutex causes the other
      threads to wait until the lock is released.
  </p>
  <p>
   For
   <code class="literal">
    InnoDB
   </code>
   mutexes that are instrumented, mutex
      waits can be monitored using
   <a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
    Performance Schema
   </a>
   . Wait
      event data collected in Performance Schema tables can help
      identify mutexes with the most waits or the greatest total wait
      time, for example.
  </p>
  <p>
   The following example demonstrates how to enable
   <code class="literal">
    InnoDB
   </code>
   mutex wait instruments, how to enable
      associated consumers, and how to query wait event data.
  </p>
  <div class="orderedlist">
   <ol class="orderedlist" type="1">
    <li class="listitem">
     <p>
      To view available
      <code class="literal">
       InnoDB
      </code>
      mutex wait
          instruments, query the Performance Schema
      <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. All
      <code class="literal">
       InnoDB
      </code>
      mutex wait instruments are disabled
          by default.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89541128"><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>setup_instruments
       <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%wait/synch/mutex/innodb%'</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><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><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>
<span class="token output"><span class="token punctuation">|</span> NAME                                                    <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> TIMED <span class="token punctuation">|</span></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><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><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>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/commit_cond_mutex               <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/innobase_share_mutex            <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/autoinc_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/autoinc_persisted_mutex         <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_flush_state_mutex      <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_LRU_list_mutex         <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_free_list_mutex        <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_zip_free_mutex         <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_zip_hash_mutex         <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_zip_mutex              <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/cache_last_read_mutex           <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_foreign_err_mutex          <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_persist_dirty_tables_mutex <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_sys_mutex                  <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recalc_pool_mutex               <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/fil_system_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/flush_list_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/fts_bg_threads_mutex            <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/fts_delete_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/fts_optimize_mutex              <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/fts_doc_id_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/log_flush_order_mutex           <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/hash_table_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/ibuf_bitmap_mutex               <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/ibuf_mutex                      <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/ibuf_pessimistic_insert_mutex   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/log_sys_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/log_sys_write_mutex             <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/mutex_list_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/page_zip_stat_per_index_mutex   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/purge_sys_pq_mutex              <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recv_sys_mutex                  <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recv_writer_mutex               <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/redo_rseg_mutex                 <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/noredo_rseg_mutex               <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rw_lock_list_mutex              <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rw_lock_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_dict_tmpfile_mutex          <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_innodb_monitor_mutex        <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_misc_tmpfile_mutex          <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_monitor_file_mutex          <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_dblwr_mutex                 <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_undo_mutex                  <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_pool_mutex                  <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_pool_manager_mutex          <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_sys_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/lock_mutex                      <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/lock_wait_mutex                 <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_mutex                       <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_threads_mutex               <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rtr_active_mutex                <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rtr_match_mutex                 <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rtr_path_mutex                  <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rtr_ssn_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_sys_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/zip_pad_mutex                   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/master_key_id_mutex             <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <span class="token punctuation">|</span></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><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><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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Some
      <code class="literal">
       InnoDB
      </code>
      mutex instances are created at
          server startup and are only instrumented if the associated
          instrument is also enabled at server startup. To ensure that
          all
      <code class="literal">
       InnoDB
      </code>
      mutex instances are instrumented
          and enabled, add the following
      <code class="literal">
       performance-schema-instrument
      </code>
      rule to your
          MySQL configuration file:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa43677682"><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-ini"><span class="token constant">performance-schema-instrument</span><span class="token attr-value"><span class="token punctuation">=</span>'wait/synch/mutex/innodb/%=ON'</span></code></pre>
     </div>
     <p>
      If you do not require wait event data for all
      <code class="literal">
       InnoDB
      </code>
      mutexes, you can disable specific
          instruments by adding additional
      <code class="literal">
       performance-schema-instrument
      </code>
      rules to your
          MySQL configuration file. For example, to disable
      <code class="literal">
       InnoDB
      </code>
      mutex wait event instruments related
          to full-text search, add the following rule:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa82323985"><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-ini"><span class="token constant">performance-schema-instrument</span><span class="token attr-value"><span class="token punctuation">=</span>'wait/synch/mutex/innodb/fts%=OFF'</span></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       Rules with a longer prefix such as
       <code class="literal">
        wait/synch/mutex/innodb/fts%
       </code>
       take
            precedence over rules with shorter prefixes such as
       <code class="literal">
        wait/synch/mutex/innodb/%
       </code>
       .
      </p>
     </div>
     <p>
      After adding the
      <code class="literal">
       performance-schema-instrument
      </code>
      rules to your
          configuration file, restart the server. All the
      <code class="literal">
       InnoDB
      </code>
      mutexes except for those related to
          full text search are enabled. To verify, query 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. The
      <code class="literal">
       ENABLED
      </code>
      and
      <code class="literal">
       TIMED
      </code>
      columns should be set to
      <code class="literal">
       YES
      </code>
      for the
          instruments that you enabled.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84802204"><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>setup_instruments
       <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%wait/synch/mutex/innodb%'</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><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><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>
<span class="token output"><span class="token punctuation">|</span> NAME                                                  <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> TIMED <span class="token punctuation">|</span></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><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><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>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/commit_cond_mutex             <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span> YES   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/innobase_share_mutex          <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span> YES   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/autoinc_mutex                 <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span> YES   <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/master_key_id_mutex           <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span> YES   <span class="token punctuation">|</span></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><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><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>
<span class="token output">49 rows in set (0.00 sec)</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Enable wait event consumers by updating the
      <a class="link" href="performance-schema-setup-consumers-table.html" title="29.12.2.2 The setup_consumers Table">
       <code class="literal">
        setup_consumers
       </code>
      </a>
      table. Wait event
          consumers are disabled by default.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71369097"><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">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_consumers
       <span class="token keyword">SET</span> enabled <span class="token operator">=</span> <span class="token string">'YES'</span>
       <span class="token keyword">WHERE</span> <span class="token keyword">name</span> <span class="token operator">like</span> <span class="token string">'events_waits%'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Rows matched: 3  Changed: 3  Warnings: 0</span></code></pre>
     </div>
     <p>
      You can verify that wait event consumers are enabled by
          querying the
      <a class="link" href="performance-schema-setup-consumers-table.html" title="29.12.2.2 The setup_consumers Table">
       <code class="literal">
        setup_consumers
       </code>
      </a>
      table. The
      <a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
       <code class="literal">
        events_waits_current
       </code>
      </a>
      ,
      <a class="link" href="performance-schema-events-waits-history-table.html" title="29.12.4.2 The events_waits_history Table">
       <code class="literal">
        events_waits_history
       </code>
      </a>
      , and
      <a class="link" href="performance-schema-events-waits-history-long-table.html" title="29.12.4.3 The events_waits_history_long Table">
       <code class="literal">
        events_waits_history_long
       </code>
      </a>
      consumers should be enabled.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81333659"><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>setup_consumers<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><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>
<span class="token output"><span class="token punctuation">|</span> NAME                             <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span></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><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>
<span class="token output"><span class="token punctuation">|</span> events_stages_current            <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_history            <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_history_long       <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_current        <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_history        <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_history_long   <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_transactions_current      <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_transactions_history      <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_transactions_history_long <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_waits_current             <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_waits_history             <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_waits_history_long        <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> global_instrumentation           <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> thread_instrumentation           <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> statements_digest                <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></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><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>
<span class="token output">15 rows in set (0.00 sec)</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Once instruments and consumers are enabled, run the workload
          that you want to monitor. In this example, the
      <a class="link" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
       <span class="command">
        <strong>
         mysqlslap
        </strong>
       </span>
      </a>
      load emulation client is used to
          simulate a workload.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa4402429"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">./mysqlslap</span> <span class="token property">--auto-generate-sql</span> <span class="token constant">--concurrency</span><span class="token attr-value"><span class="token punctuation">=</span>100</span> <span class="token constant">--iterations</span><span class="token attr-value"><span class="token punctuation">=</span>10</span> 
       <span class="token constant">--number-of-queries</span><span class="token attr-value"><span class="token punctuation">=</span>1000</span> <span class="token constant">--number-char-cols</span><span class="token attr-value"><span class="token punctuation">=</span>6</span> <span class="token constant">--number-int-cols</span><span class="token attr-value"><span class="token punctuation">=</span>6;</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Query the wait event data. In this example, wait event data is
          queried from the
      <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>
      table which aggregates data found in the
      <a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
       <code class="literal">
        events_waits_current
       </code>
      </a>
      ,
      <a class="link" href="performance-schema-events-waits-history-table.html" title="29.12.4.2 The events_waits_history Table">
       <code class="literal">
        events_waits_history
       </code>
      </a>
      , and
      <a class="link" href="performance-schema-events-waits-history-long-table.html" title="29.12.4.3 The events_waits_history_long Table">
       <code class="literal">
        events_waits_history_long
       </code>
      </a>
      tables.
          Data is summarized by event name
          (
      <code class="literal">
       EVENT_NAME
      </code>
      ), which is the name of the
          instrument that produced the event. Summarized data includes:
     </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 wait events.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          SUM_TIMER_WAIT
         </code>
        </p>
        <p>
         The total wait time of the summarized timed wait events.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          MIN_TIMER_WAIT
         </code>
        </p>
        <p>
         The minimum wait time of the summarized timed wait events.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          AVG_TIMER_WAIT
         </code>
        </p>
        <p>
         The average wait time of the summarized timed wait events.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          MAX_TIMER_WAIT
         </code>
        </p>
        <p>
         The maximum wait time of the summarized timed wait events.
        </p>
       </li>
      </ul>
     </div>
     <p>
      The following query returns the instrument name
          (
      <code class="literal">
       EVENT_NAME
      </code>
      ), the number of wait events
          (
      <code class="literal">
       COUNT_STAR
      </code>
      ), and the total wait time for
          the events for that instrument
          (
      <code class="literal">
       SUM_TIMER_WAIT
      </code>
      ). Because waits are timed
          in picoseconds (trillionths of a second) by default, wait
          times are divided by 1000000000 to show wait times in
          milliseconds. Data is presented in descending order, by the
          number of summarized wait events
          (
      <code class="literal">
       COUNT_STAR
      </code>
      ). You can adjust the
      <code class="literal">
       ORDER BY
      </code>
      clause to order the data by total
          wait time.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63888365"><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> EVENT_NAME<span class="token punctuation">,</span> COUNT_STAR<span class="token punctuation">,</span> SUM_TIMER_WAIT<span class="token operator">/</span><span class="token number">1000000000</span> SUM_TIMER_WAIT_MS
       <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_waits_summary_global_by_event_name
       <span class="token keyword">WHERE</span> SUM_TIMER_WAIT <span class="token operator">&gt;</span> <span class="token number">0</span> <span class="token operator">AND</span> EVENT_NAME <span class="token operator">LIKE</span> <span class="token string">'wait/synch/mutex/innodb/%'</span>
       <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> COUNT_STAR <span class="token keyword">DESC</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><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><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><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>
<span class="token output"><span class="token punctuation">|</span> EVENT_NAME                                              <span class="token punctuation">|</span> COUNT_STAR <span class="token punctuation">|</span> SUM_TIMER_WAIT_MS <span class="token punctuation">|</span></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><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><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><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>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_mutex                       <span class="token punctuation">|</span>     201111 <span class="token punctuation">|</span>           23.4719 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/fil_system_mutex                <span class="token punctuation">|</span>      62244 <span class="token punctuation">|</span>            9.6426 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/redo_rseg_mutex                 <span class="token punctuation">|</span>      48238 <span class="token punctuation">|</span>            3.1135 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/log_sys_mutex                   <span class="token punctuation">|</span>      46113 <span class="token punctuation">|</span>            2.0434 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_sys_mutex                   <span class="token punctuation">|</span>      35134 <span class="token punctuation">|</span>         1068.1588 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/lock_mutex                      <span class="token punctuation">|</span>      34872 <span class="token punctuation">|</span>         1039.2589 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/log_sys_write_mutex             <span class="token punctuation">|</span>      17805 <span class="token punctuation">|</span>         1526.0490 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_sys_mutex                  <span class="token punctuation">|</span>      14912 <span class="token punctuation">|</span>         1606.7348 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_undo_mutex                  <span class="token punctuation">|</span>      10634 <span class="token punctuation">|</span>            1.1424 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/rw_lock_list_mutex              <span class="token punctuation">|</span>       8538 <span class="token punctuation">|</span>            0.1960 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_free_list_mutex        <span class="token punctuation">|</span>       5961 <span class="token punctuation">|</span>            0.6473 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_pool_mutex                  <span class="token punctuation">|</span>       4885 <span class="token punctuation">|</span>         8821.7496 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_LRU_list_mutex         <span class="token punctuation">|</span>       4364 <span class="token punctuation">|</span>            0.2077 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/innobase_share_mutex            <span class="token punctuation">|</span>       3212 <span class="token punctuation">|</span>            0.2650 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/flush_list_mutex                <span class="token punctuation">|</span>       3178 <span class="token punctuation">|</span>            0.2349 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/trx_pool_manager_mutex          <span class="token punctuation">|</span>       2495 <span class="token punctuation">|</span>            0.1310 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_flush_state_mutex      <span class="token punctuation">|</span>       1318 <span class="token punctuation">|</span>            0.2161 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/log_flush_order_mutex           <span class="token punctuation">|</span>       1250 <span class="token punctuation">|</span>            0.0893 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_dblwr_mutex                 <span class="token punctuation">|</span>        951 <span class="token punctuation">|</span>            0.0918 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recalc_pool_mutex               <span class="token punctuation">|</span>        670 <span class="token punctuation">|</span>            0.0942 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_persist_dirty_tables_mutex <span class="token punctuation">|</span>        345 <span class="token punctuation">|</span>            0.0414 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/lock_wait_mutex                 <span class="token punctuation">|</span>        303 <span class="token punctuation">|</span>            0.1565 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/autoinc_mutex                   <span class="token punctuation">|</span>        196 <span class="token punctuation">|</span>            0.0213 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/autoinc_persisted_mutex         <span class="token punctuation">|</span>        196 <span class="token punctuation">|</span>            0.0175 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/purge_sys_pq_mutex              <span class="token punctuation">|</span>        117 <span class="token punctuation">|</span>            0.0308 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_sys_mutex                   <span class="token punctuation">|</span>         94 <span class="token punctuation">|</span>            0.0077 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/ibuf_mutex                      <span class="token punctuation">|</span>         22 <span class="token punctuation">|</span>            0.0086 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recv_sys_mutex                  <span class="token punctuation">|</span>         12 <span class="token punctuation">|</span>            0.0008 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/srv_innodb_monitor_mutex        <span class="token punctuation">|</span>          4 <span class="token punctuation">|</span>            0.0009 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recv_writer_mutex               <span class="token punctuation">|</span>          1 <span class="token punctuation">|</span>            0.0005 <span class="token punctuation">|</span></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><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><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><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></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       The preceding result set includes wait event data produced
            during the startup process. To exclude this data, you can
            truncate the
       <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>
       table immediately after startup and before running your
            workload. However, the truncate operation itself may produce
            a negligible amount wait event data.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa92943100"><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">TRUNCATE</span> performance_schema<span class="token punctuation">.</span>events_waits_summary_global_by_event_name<span class="token punctuation">;</span></code></pre>
      </div>
     </div>
    </li>
   </ol>
  </div>
 </div>
 <br/>
</div>
