<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="performance-schema-quick-start">
      </a>
      29.1 Performance Schema Quick Start
     </h2>
    </div>
   </div>
  </div>
  <p>
   This section briefly introduces the Performance Schema with
      examples that show how to use it. For additional examples, see
   <a class="xref" href="performance-schema-examples.html" title="29.19 Using the Performance Schema to Diagnose Problems">
    Section 29.19, “Using the Performance Schema to Diagnose Problems”
   </a>
   .
  </p>
  <p>
   The Performance Schema is enabled by default. To enable or disable
      it explicitly, start the server with the
   <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema">
    <code class="literal">
     performance_schema
    </code>
   </a>
   variable set
      to an appropriate value. For example, use these lines in the
      server
   <code class="filename">
    my.cnf
   </code>
   file:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa80590934"><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 selector">[mysqld]</span>
<span class="token constant">performance_schema</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span></code></pre>
  </div>
  <p>
   When the server starts, it sees
   <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema">
    <code class="literal">
     performance_schema
    </code>
   </a>
   and attempts
      to initialize the Performance Schema. To verify successful
      initialization, use this statement:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55566322"><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">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'performance_schema'</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>
<span class="token output"><span class="token punctuation">|</span> Variable_name      <span class="token punctuation">|</span> Value <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>
<span class="token output"><span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> ON    <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></code></pre>
  </div>
  <p>
   A value of
   <code class="literal">
    ON
   </code>
   means that the Performance Schema
      initialized successfully and is ready for use. A value of
   <code class="literal">
    OFF
   </code>
   means that some error occurred. Check the
      server error log for information about what went wrong.
  </p>
  <p>
   The Performance Schema is implemented as a storage engine, so you
      can see it listed in the output from the Information Schema
   <a class="link" href="information-schema-engines-table.html" title="28.3.13 The INFORMATION_SCHEMA ENGINES Table">
    <code class="literal">
     ENGINES
    </code>
   </a>
   table or the
   <a class="link" href="show-engines.html" title="15.7.7.17 SHOW ENGINES Statement">
    <code class="literal">
     SHOW ENGINES
    </code>
   </a>
   statement:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18300789"><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> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">ENGINES</span>
       <span class="token keyword">WHERE</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token string">'PERFORMANCE_SCHEMA'</span>\G
<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> 1. 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>
      ENGINE<span class="token punctuation">:</span> PERFORMANCE_SCHEMA
     SUPPORT<span class="token punctuation">:</span> YES
     COMMENT<span class="token punctuation">:</span> Performance Schema
TRANSACTIONS<span class="token punctuation">:</span> NO
          XA<span class="token punctuation">:</span> NO
  SAVEPOINTS<span class="token punctuation">:</span> NO
</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">ENGINES</span>\G
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
      <span class="token keyword">Engine</span>: PERFORMANCE_SCHEMA
     Support: YES
     <span class="token keyword">Comment</span>: Performance <span class="token keyword">Schema</span>
Transactions: <span class="token keyword">NO</span>
          <span class="token keyword">XA</span>: <span class="token keyword">NO</span>
  Savepoints: <span class="token keyword">NO</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   The
   <a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
    <code class="literal">
     PERFORMANCE_SCHEMA
    </code>
   </a>
   storage engine
      operates on tables in the
   <code class="literal">
    performance_schema
   </code>
   database. You can make
   <code class="literal">
    performance_schema
   </code>
   the
      default database so that references to its tables need not be
      qualified with the database name:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa39555297"><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">USE</span> performance_schema<span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   Performance Schema tables are stored in the
   <code class="literal">
    performance_schema
   </code>
   database. Information about
      the structure of this database and its tables can be obtained, as
      for any other database, by selecting from the
   <code class="literal">
    INFORMATION_SCHEMA
   </code>
   database or by using
   <a class="link" href="show.html" title="15.7.7 SHOW Statements">
    <code class="literal">
     SHOW
    </code>
   </a>
   statements. For example, use
      either of these statements to see what Performance Schema tables
      exist:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49816337"><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 keyword">TABLE_NAME</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span>
       <span class="token keyword">WHERE</span> TABLE_SCHEMA <span class="token operator">=</span> <span class="token string">'performance_schema'</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>
<span class="token output"><span class="token punctuation">|</span> TABLE_NAME                                           <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>
<span class="token output"><span class="token punctuation">|</span> accounts                                             <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cond_instances                                       <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> events_stages_current                                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_history                                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_history_long                           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_summary_by_account_by_event_name       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_summary_by_host_by_event_name          <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_summary_by_thread_by_event_name        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_summary_by_user_by_event_name          <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_summary_global_by_event_name           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_current                            <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_history                            <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_history_long                       <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> file_instances                                       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> file_summary_by_event_name                           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> file_summary_by_instance                             <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> host_cache                                           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hosts                                                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory_summary_by_account_by_event_name              <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory_summary_by_host_by_event_name                 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory_summary_by_thread_by_event_name               <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory_summary_by_user_by_event_name                 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory_summary_global_by_event_name                  <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> metadata_locks                                       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> mutex_instances                                      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> objects_summary_global_by_type                       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_timers                                   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> replication_connection_configuration                 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> replication_connection_status                        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> replication_applier_configuration                    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> replication_applier_status                           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> replication_applier_status_by_coordinator            <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> replication_applier_status_by_worker                 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> rwlock_instances                                     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> session_account_connect_attrs                        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> session_connect_attrs                                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> setup_actors                                         <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> setup_consumers                                      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> setup_instruments                                    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> setup_objects                                        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> socket_instances                                     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> socket_summary_by_event_name                         <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> socket_summary_by_instance                           <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> table_handles                                        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> table_io_waits_summary_by_index_usage                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> table_io_waits_summary_by_table                      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> table_lock_waits_summary_by_table                    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> threads                                              <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> users                                                <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">TABLES</span> <span class="token keyword">FROM</span> performance_schema<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>
<span class="token output"><span class="token punctuation">|</span> Tables_in_performance_schema                         <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>
<span class="token output"><span class="token punctuation">|</span> accounts                                             <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cond_instances                                       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_current                                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_history                                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_stages_history_long                           <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   The number of Performance Schema tables increases over time as
      implementation of additional instrumentation proceeds.
  </p>
  <p>
   The name of the
   <code class="literal">
    performance_schema
   </code>
   database is
      lowercase, as are the names of tables within it. Queries should
      specify the names in lowercase.
  </p>
  <p>
   To see the structure of individual tables, use
   <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
    <code class="literal">
     SHOW CREATE TABLE
    </code>
   </a>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74388023"><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">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> performance_schema<span class="token punctuation">.</span>setup_consumers\G
<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> 1. 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>
       Table<span class="token punctuation">:</span> setup_consumers
Create Table<span class="token punctuation">:</span> CREATE TABLE `setup_consumers` (
  `NAME` varchar(64) NOT NULL,
  `ENABLED` enum('YES','NO') NOT NULL,
  PRIMARY KEY (`NAME`)
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
  </div>
  <p>
   Table structure is also available by selecting from tables such as
   <a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
    <code class="literal">
     INFORMATION_SCHEMA.COLUMNS
    </code>
   </a>
   or by
      using statements such as
   <a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
    <code class="literal">
     SHOW
      COLUMNS
    </code>
   </a>
   .
  </p>
  <p>
   Tables in the
   <code class="literal">
    performance_schema
   </code>
   database can
      be grouped according to the type of information in them: Current
      events, event histories and summaries, object instances, and setup
      (configuration) information. The following examples illustrate a
      few uses for these tables. For detailed information about the
      tables in each group, see
   <a class="xref" href="performance-schema-table-descriptions.html" title="29.12 Performance Schema Table Descriptions">
    Section 29.12, “Performance Schema Table Descriptions”
   </a>
   .
  </p>
  <p>
   Initially, not all instruments and consumers are enabled, so the
      performance schema does not collect all events. To turn all of
      these on and enable event timing, execute two statements (the row
      counts may differ depending on MySQL version):
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10527538"><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_instruments
       <span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span><span class="token punctuation">,</span> TIMED <span class="token operator">=</span> <span class="token string">'YES'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 560 rows affected (0.04 sec)</span>
<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 punctuation">;</span>
<span class="token output">Query OK, 10 rows affected (0.00 sec)</span></code></pre>
  </div>
  <p>
   To see what the server is doing at the moment, examine 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>
   table. It
      contains one row per thread showing each thread's most recent
      monitored event:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92565743"><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_current\G
<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> 1. 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>
            THREAD_ID<span class="token punctuation">:</span> 0
             EVENT_ID<span class="token punctuation">:</span> 5523
         END_EVENT_ID<span class="token punctuation">:</span> 5523
           EVENT_NAME<span class="token punctuation">:</span> wait/synch/mutex/mysys/THR_LOCK<span class="token punctuation">:</span><span class="token punctuation">:</span>mutex
               SOURCE<span class="token punctuation">:</span> thr_lock.c<span class="token punctuation">:</span>525
          TIMER_START<span class="token punctuation">:</span> 201660494489586
            TIMER_END<span class="token punctuation">:</span> 201660494576112
           TIMER_WAIT<span class="token punctuation">:</span> 86526
                SPINS<span class="token punctuation">:</span> NULL
        OBJECT_SCHEMA<span class="token punctuation">:</span> NULL
          OBJECT_NAME<span class="token punctuation">:</span> NULL
           INDEX_NAME<span class="token punctuation">:</span> NULL
          OBJECT_TYPE<span class="token punctuation">:</span> NULL
OBJECT_INSTANCE_BEGIN<span class="token punctuation">:</span> 142270668
     NESTING_EVENT_ID<span class="token punctuation">:</span> NULL
   NESTING_EVENT_TYPE<span class="token punctuation">:</span> NULL
            OPERATION<span class="token punctuation">:</span> lock
      NUMBER_OF_BYTES<span class="token punctuation">:</span> NULL
                FLAGS<span class="token punctuation">:</span> 0
...</span></code></pre>
  </div>
  <p>
   This event indicates that thread 0 was waiting for 86,526
      picoseconds to acquire a lock on
   <code class="literal">
    THR_LOCK::mutex
   </code>
   , a mutex in the
   <code class="literal">
    mysys
   </code>
   subsystem. The first few columns provide
      the following information:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The ID columns indicate which thread the event comes from and
          the event number.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_NAME
      </code>
      indicates what was instrumented
          and
      <code class="literal">
       SOURCE
      </code>
      indicates which source file
          contains the instrumented code.
     </p>
    </li>
    <li class="listitem">
     <p>
      The timer columns show when the event started and stopped and
          how long it took. If an event is still in progress, the
      <code class="literal">
       TIMER_END
      </code>
      and
      <code class="literal">
       TIMER_WAIT
      </code>
      values are
      <code class="literal">
       NULL
      </code>
      . Timer values are
          approximate and expressed in picoseconds. For information
          about timers and event time collection, see
      <a class="xref" href="performance-schema-timing.html" title="29.4.1 Performance Schema Event Timing">
       Section 29.4.1, “Performance Schema Event Timing”
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   The history tables contain the same kind of rows as the
      current-events table but have more rows and show what the server
      has been doing
   <span class="quote">
    “
    <span class="quote">
     recently
    </span>
    ”
   </span>
   rather than
   <span class="quote">
    “
    <span class="quote">
     currently.
    </span>
    ”
   </span>
   The
   <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
      contain the most recent 10 events per thread and most recent
      10,000 events, respectively. For example, to see information for
      recent events produced by thread 13, do this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7034706"><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_ID<span class="token punctuation">,</span> EVENT_NAME<span class="token punctuation">,</span> TIMER_WAIT
       <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_waits_history
       <span class="token keyword">WHERE</span> THREAD_ID <span class="token operator">=</span> <span class="token number">13</span>
       <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> EVENT_ID<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>
<span class="token output"><span class="token punctuation">|</span> EVENT_ID <span class="token punctuation">|</span> EVENT_NAME                              <span class="token punctuation">|</span> TIMER_WAIT <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>
<span class="token output"><span class="token punctuation">|</span>       86 <span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK::mutex  <span class="token punctuation">|</span>     686322 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       87 <span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc  <span class="token punctuation">|</span>     320535 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       88 <span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc  <span class="token punctuation">|</span>     339390 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       89 <span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc  <span class="token punctuation">|</span>     377100 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       90 <span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_plugin        <span class="token punctuation">|</span>     614673 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       91 <span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_open          <span class="token punctuation">|</span>     659925 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       92 <span class="token punctuation">|</span> wait/synch/mutex/sql/THD::LOCK_thd_data <span class="token punctuation">|</span>     494001 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       93 <span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc  <span class="token punctuation">|</span>     222489 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       94 <span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc  <span class="token punctuation">|</span>     214947 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>       95 <span class="token punctuation">|</span> wait/synch/mutex/mysys/LOCK_alarm       <span class="token punctuation">|</span>     312993 <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></code></pre>
  </div>
  <p>
   As new events are added to a history table, older events are
      discarded if the table is full.
  </p>
  <p>
   Summary tables provide aggregated information for all events over
      time. The tables in this group summarize event data in different
      ways. To see which instruments have been executed the most times
      or have taken the most wait time, sort 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 on the
   <code class="literal">
    COUNT_STAR
   </code>
   or
   <code class="literal">
    SUM_TIMER_WAIT
   </code>
   column, which correspond to a
   <code class="literal">
    COUNT(*)
   </code>
   or
   <code class="literal">
    SUM(TIMER_WAIT)
   </code>
   value, respectively, calculated over all events:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99944842"><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 keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_waits_summary_global_by_event_name
       <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> COUNT_STAR <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">10</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>
<span class="token output"><span class="token punctuation">|</span> EVENT_NAME                                        <span class="token punctuation">|</span> COUNT_STAR <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>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc            <span class="token punctuation">|</span>       6419 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/FRM                              <span class="token punctuation">|</span>        452 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_plugin                  <span class="token punctuation">|</span>        337 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_open              <span class="token punctuation">|</span>        187 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/mysys/LOCK_alarm                 <span class="token punctuation">|</span>        147 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/THD::LOCK_thd_data           <span class="token punctuation">|</span>        115 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/myisam/kfile                         <span class="token punctuation">|</span>        102 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_global_system_variables <span class="token punctuation">|</span>         89 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK::mutex            <span class="token punctuation">|</span>         89 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_open                    <span class="token punctuation">|</span>         88 <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> EVENT_NAME<span class="token punctuation">,</span> SUM_TIMER_WAIT
       <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_waits_summary_global_by_event_name
       <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> SUM_TIMER_WAIT <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">10</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>
<span class="token output"><span class="token punctuation">|</span> EVENT_NAME                             <span class="token punctuation">|</span> SUM_TIMER_WAIT <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>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/MYSQL_LOG             <span class="token punctuation">|</span>     1599816582 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/mysys/THR_LOCK_malloc <span class="token punctuation">|</span>     1530083250 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/binlog_index          <span class="token punctuation">|</span>     1385291934 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/FRM                   <span class="token punctuation">|</span>     1292823243 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/myisam/kfile              <span class="token punctuation">|</span>      411193611 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/myisam/dfile              <span class="token punctuation">|</span>      322401645 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/mysys/LOCK_alarm      <span class="token punctuation">|</span>      145126935 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/casetest              <span class="token punctuation">|</span>      104324715 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_plugin       <span class="token punctuation">|</span>       86027823 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/pid                   <span class="token punctuation">|</span>       72591750 <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></code></pre>
  </div>
  <p>
   These results show that the
   <code class="literal">
    THR_LOCK_malloc
   </code>
   mutex is
   <span class="quote">
    “
    <span class="quote">
     hot,
    </span>
    ”
   </span>
   both in terms of how often it is used
      and amount of time that threads wait attempting to acquire it.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    The
    <code class="literal">
     THR_LOCK_malloc
    </code>
    mutex is used only in
        debug builds. In production builds it is not hot because it is
        nonexistent.
   </p>
  </div>
  <p>
   Instance tables document what types of objects are instrumented.
      An instrumented object, when used by the server, produces an
      event. These tables provide event names and explanatory notes or
      status information. For example, the
   <a class="link" href="performance-schema-file-instances-table.html" title="29.12.3.2 The file_instances Table">
    <code class="literal">
     file_instances
    </code>
   </a>
   table lists instances
      of instruments for file I/O operations and their associated files:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7409478"><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>file_instances\G
<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> 1. 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>
 FILE_NAME<span class="token punctuation">:</span> /opt/mysql-log/60500/binlog.000007
EVENT_NAME<span class="token punctuation">:</span> wait/io/file/sql/binlog
OPEN_COUNT<span class="token punctuation">:</span> 0
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. 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>
 FILE_NAME<span class="token punctuation">:</span> /opt/mysql/60500/data/mysql/tables_priv.MYI
EVENT_NAME<span class="token punctuation">:</span> wait/io/file/myisam/kfile
OPEN_COUNT<span class="token punctuation">:</span> 1
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 3. 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>
 FILE_NAME<span class="token punctuation">:</span> /opt/mysql/60500/data/mysql/columns_priv.MYI
EVENT_NAME<span class="token punctuation">:</span> wait/io/file/myisam/kfile
OPEN_COUNT<span class="token punctuation">:</span> 1
...</span></code></pre>
  </div>
  <p>
   Setup tables are used to configure and display monitoring
      characteristics. For example,
   <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>
   lists the set of
      instruments for which events can be collected and shows which of
      them are enabled:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8199930"><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 keyword">NAME</span><span class="token punctuation">,</span> ENABLED<span class="token punctuation">,</span> TIMED
       <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments<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>
<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>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/end                                     <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> stage/sql/executing                               <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> stage/sql/init                                    <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> stage/sql/insert                                  <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span> NO    <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> statement/sql/load                                <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> statement/sql/grant                               <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> statement/sql/check                               <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> statement/sql/flush                               <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/sql/LOCK_global_read_lock        <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/sql/LOCK_global_system_variables <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/sql/LOCK_lock_db                 <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/sql/LOCK_manager                 <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/rwlock/sql/LOCK_grant                  <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/rwlock/sql/LOGGER::LOCK_logger         <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/rwlock/sql/LOCK_sys_init_connect       <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/rwlock/sql/LOCK_sys_init_slave         <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/io/file/sql/binlog                           <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/io/file/sql/binlog_index                     <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/io/file/sql/casetest                         <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/io/file/sql/dbopt                            <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></code></pre>
  </div>
  <p>
   To understand how to interpret instrument names, see
   <a class="xref" href="performance-schema-instrument-naming.html" title="29.6 Performance Schema Instrument Naming Conventions">
    Section 29.6, “Performance Schema Instrument Naming Conventions”
   </a>
   .
  </p>
  <p>
   To control whether events are collected for an instrument, set its
   <code class="literal">
    ENABLED
   </code>
   value to
   <code class="literal">
    YES
   </code>
   or
   <code class="literal">
    NO
   </code>
   . For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47457320"><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_instruments
       <span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'NO'</span>
       <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'wait/synch/mutex/sql/LOCK_mysql_create_db'</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   The Performance Schema uses collected events to update tables in
      the
   <code class="literal">
    performance_schema
   </code>
   database, which act as
   <span class="quote">
    “
    <span class="quote">
     consumers
    </span>
    ”
   </span>
   of event information. 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 lists the
      available consumers and which are enabled:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34964743"><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_cpu            <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> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_waits_history             <span class="token punctuation">|</span> NO      <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_waits_history_long        <span class="token punctuation">|</span> NO      <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></code></pre>
  </div>
  <p>
   To control whether the Performance Schema maintains a consumer as
      a destination for event information, set its
   <code class="literal">
    ENABLED
   </code>
   value.
  </p>
  <p>
   For more information about the setup tables and how to use them to
      control event collection, see
   <a class="xref" href="performance-schema-filtering.html" title="29.4.2 Performance Schema Event Filtering">
    Section 29.4.2, “Performance Schema Event Filtering”
   </a>
   .
  </p>
  <p>
   There are some miscellaneous tables that do not fall into any of
      the previous groups. For example,
   <a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
    <code class="literal">
     performance_timers
    </code>
   </a>
   lists the
      available event timers and their characteristics. For information
      about timers, see
   <a class="xref" href="performance-schema-timing.html" title="29.4.1 Performance Schema Event Timing">
    Section 29.4.1, “Performance Schema Event Timing”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
