<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="performance-schema-status-monitoring">
      </a>
      29.7 Performance Schema Status Monitoring
     </h2>
    </div>
   </div>
  </div>
  <p>
   There are several status variables associated with the Performance
      Schema:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56979624"><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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'perf%'</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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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_accounts_lost              <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_cond_classes_lost          <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_cond_instances_lost        <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_digest_lost                <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_file_classes_lost          <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_file_handles_lost          <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_file_instances_lost        <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_hosts_lost                 <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_locker_lost                <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_memory_classes_lost        <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_metadata_lock_lost         <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_mutex_classes_lost         <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_mutex_instances_lost       <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_nested_statement_lost      <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_program_lost               <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_rwlock_classes_lost        <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_rwlock_instances_lost      <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_session_connect_attrs_lost <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_socket_classes_lost        <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_socket_instances_lost      <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_stage_classes_lost         <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_statement_classes_lost     <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_table_handles_lost         <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_table_instances_lost       <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_thread_classes_lost        <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_thread_instances_lost      <span class="token punctuation">|</span> 0     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_users_lost                 <span class="token punctuation">|</span> 0     <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></code></pre>
  </div>
  <p>
   The Performance Schema status variables provide information about
      instrumentation that could not be loaded or created due to memory
      constraints. Names for these variables have several forms:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       Performance_schema_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _classes_lost
      </code>
      indicates how many instruments of type
      <em class="replaceable">
       <code>
        xxx
       </code>
      </em>
      could not be loaded.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Performance_schema_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _instances_lost
      </code>
      indicates how many instances of object type
      <em class="replaceable">
       <code>
        xxx
       </code>
      </em>
      could not be created.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Performance_schema_
       <em class="replaceable">
        <code>
         xxx
        </code>
       </em>
       _handles_lost
      </code>
      indicates how many instances of object type
      <em class="replaceable">
       <code>
        xxx
       </code>
      </em>
      could not be opened.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Performance_schema_locker_lost
      </code>
      indicates
          how many events are
      <span class="quote">
       “
       <span class="quote">
        lost
       </span>
       ”
      </span>
      or not recorded.
     </p>
    </li>
   </ul>
  </div>
  <p>
   For example, if a mutex is instrumented in the server source but
      the server cannot allocate memory for the instrumentation at
      runtime, it increments
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost">
    <code class="literal">
     Performance_schema_mutex_classes_lost
    </code>
   </a>
   .
      The mutex still functions as a synchronization object (that is,
      the server continues to function normally), but performance data
      for it is not collected. If the instrument can be allocated, it
      can be used for initializing instrumented mutex instances. For a
      singleton mutex such as a global mutex, there is only one
      instance. Other mutexes have an instance per connection, or per
      page in various caches and data buffers, so the number of
      instances varies over time. Increasing the maximum number of
      connections or the maximum size of some buffers increases the
      maximum number of instances that might be allocated at once. If
      the server cannot create a given instrumented mutex instance, it
      increments
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_instances_lost">
    <code class="literal">
     Performance_schema_mutex_instances_lost
    </code>
   </a>
   .
  </p>
  <p>
   Suppose that the following conditions hold:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The server was started with the
      <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
       <code class="option">
        --performance_schema_max_mutex_classes=200
       </code>
      </a>
      option and thus has room for 200 mutex instruments.
     </p>
    </li>
    <li class="listitem">
     <p>
      150 mutex instruments have been loaded already.
     </p>
    </li>
    <li class="listitem">
     <p>
      The plugin named
      <code class="literal">
       plugin_a
      </code>
      contains 40 mutex
          instruments.
     </p>
    </li>
    <li class="listitem">
     <p>
      The plugin named
      <code class="literal">
       plugin_b
      </code>
      contains 20 mutex
          instruments.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The server allocates mutex instruments for the plugins depending
      on how many they need and how many are available, as illustrated
      by the following sequence of statements:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa30532506"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> plugin_a</code></pre>
  </div>
  <p>
   The server now has 150+40 = 190 mutex instruments.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10018656"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UNINSTALL</span> <span class="token keyword">PLUGIN</span> plugin_a<span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   The server still has 190 instruments. All the historical data
      generated by the plugin code is still available, but new events
      for the instruments are not collected.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa76627941"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> plugin_a<span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   The server detects that the 40 instruments are already defined, so
      no new instruments are created, and previously assigned internal
      memory buffers are reused. The server still has 190 instruments.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa83092643"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> plugin_b<span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   The server has room for 200-190 = 10 instruments (in this case,
      mutex classes), and sees that the plugin contains 20 new
      instruments. 10 instruments are loaded, and 10 are discarded or
   <span class="quote">
    “
    <span class="quote">
     lost.
    </span>
    ”
   </span>
   The
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost">
    <code class="literal">
     Performance_schema_mutex_classes_lost
    </code>
   </a>
   indicates the number of instruments (mutex classes) lost:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28620951"><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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">"perf%mutex_classes_lost"</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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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_mutex_classes_lost <span class="token punctuation">|</span> 10    <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>
<span class="token output">1 row in set (0.10 sec)</span></code></pre>
  </div>
  <p>
   The instrumentation still works and collects (partial) data for
   <code class="literal">
    plugin_b
   </code>
   .
  </p>
  <p>
   When the server cannot create a mutex instrument, these results
      occur:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      No row for the instrument is inserted into the
      <a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
       <code class="literal">
        setup_instruments
       </code>
      </a>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost">
       <code class="literal">
        Performance_schema_mutex_classes_lost
       </code>
      </a>
      increases by 1.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_instances_lost">
       <code class="literal">
        Performance_schema_mutex_instances_lost
       </code>
      </a>
      does not change. (When the mutex instrument is not created, it
          cannot be used to create instrumented mutex instances later.)
     </p>
    </li>
   </ul>
  </div>
  <p>
   The pattern just described applies to all types of instruments,
      not just mutexes.
  </p>
  <p>
   A value of
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost">
    <code class="literal">
     Performance_schema_mutex_classes_lost
    </code>
   </a>
   greater than 0 can happen in two cases:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      To save a few bytes of memory, you start the server with
      <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
       <code class="option">
        --performance_schema_max_mutex_classes=
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
       </code>
      </a>
      ,
          where
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      is less than the default
          value. The default value is chosen to be sufficient to load
          all the plugins provided in the MySQL distribution, but this
          can be reduced if some plugins are never loaded. For example,
          you might choose not to load some of the storage engines in
          the distribution.
     </p>
    </li>
    <li class="listitem">
     <p>
      You load a third-party plugin that is instrumented for the
          Performance Schema but do not allow for the plugin's
          instrumentation memory requirements when you start the server.
          Because it comes from a third party, the instrument memory
          consumption of this engine is not accounted for in the default
          value chosen for
      <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
       <code class="literal">
        performance_schema_max_mutex_classes
       </code>
      </a>
      .
     </p>
     <p>
      If the server has insufficient resources for the plugin's
          instruments and you do not explicitly allocate more using
      <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
       <code class="option">
        --performance_schema_max_mutex_classes=
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
       </code>
      </a>
      ,
          loading the plugin leads to starvation of instruments.
     </p>
    </li>
   </ul>
  </div>
  <p>
   If the value chosen for
   <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
    <code class="literal">
     performance_schema_max_mutex_classes
    </code>
   </a>
   is too small, no error is reported in the error log and there is
      no failure at runtime. However, the content of the tables in the
   <code class="literal">
    performance_schema
   </code>
   database misses events. The
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost">
    <code class="literal">
     Performance_schema_mutex_classes_lost
    </code>
   </a>
   status variable is the only visible sign to indicate that some
      events were dropped internally due to failure to create
      instruments.
  </p>
  <p>
   If an instrument is not lost, it is known to the Performance
      Schema, and is used when instrumenting instances. For example,
   <code class="literal">
    wait/synch/mutex/sql/LOCK_delete
   </code>
   is the name of
      a mutex instrument in the
   <a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
    <code class="literal">
     setup_instruments
    </code>
   </a>
   table. This single
      instrument is used when creating a mutex in the code (in
   <code class="literal">
    THD::LOCK_delete
   </code>
   ) however many instances of the
      mutex are needed as the server runs. In this case,
   <code class="literal">
    LOCK_delete
   </code>
   is a mutex that is per connection
      (
   <code class="literal">
    THD
   </code>
   ), so if a server has 1000 connections,
      there are 1000 threads, and 1000 instrumented
   <code class="literal">
    LOCK_delete
   </code>
   mutex instances
      (
   <code class="literal">
    THD::LOCK_delete
   </code>
   ).
  </p>
  <p>
   If the server does not have room for all these 1000 instrumented
      mutexes (instances), some mutexes are created with
      instrumentation, and some are created without instrumentation. If
      the server can create only 800 instances, 200 instances are lost.
      The server continues to run, but increments
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_instances_lost">
    <code class="literal">
     Performance_schema_mutex_instances_lost
    </code>
   </a>
   by 200 to indicate that instances could not be created.
  </p>
  <p>
   A value of
   <a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_instances_lost">
    <code class="literal">
     Performance_schema_mutex_instances_lost
    </code>
   </a>
   greater than 0 can happen when the code initializes more mutexes
      at runtime than were allocated for
   <a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_instances">
    <code class="option">
     --performance_schema_max_mutex_instances=
     <em class="replaceable">
      <code>
       N
      </code>
     </em>
    </code>
   </a>
   .
  </p>
  <p>
   The bottom line is that if
   <a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
    <code class="literal">
     SHOW STATUS LIKE
      'perf%'
    </code>
   </a>
   says that nothing was lost (all values are
      zero), the Performance Schema data is accurate and can be relied
      upon. If something was lost, the data is incomplete, and the
      Performance Schema could not record everything given the
      insufficient amount of memory it was given to use. In this case,
      the specific
   <code class="literal">
    Performance_schema_
    <em class="replaceable">
     <code>
      xxx
     </code>
    </em>
    _lost
   </code>
   variable indicates the problem area.
  </p>
  <p>
   It might be appropriate in some cases to cause deliberate
      instrument starvation. For example, if you do not care about
      performance data for file I/O, you can start the server with all
      Performance Schema parameters related to file I/O set to 0. No
      memory is allocated for file-related classes, instances, or
      handles, and all file events are lost.
  </p>
  <p>
   Use
   <a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
    <code class="literal">
     SHOW ENGINE
      PERFORMANCE_SCHEMA STATUS
    </code>
   </a>
   to inspect the internal
      operation of the Performance Schema code:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33458433"><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">ENGINE</span> PERFORMANCE_SCHEMA <span class="token keyword">STATUS</span>\G
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 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>
  Type<span class="token punctuation">:</span> performance_schema
  Name<span class="token punctuation">:</span> events_waits_history.size
Status<span class="token punctuation">:</span> 76
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 4. 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>
  Type<span class="token punctuation">:</span> performance_schema
  Name<span class="token punctuation">:</span> events_waits_history.count
Status<span class="token punctuation">:</span> 10000
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 5. 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>
  Type<span class="token punctuation">:</span> performance_schema
  Name<span class="token punctuation">:</span> events_waits_history.memory
Status<span class="token punctuation">:</span> 760000
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 57. 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>
  Type<span class="token punctuation">:</span> performance_schema
  Name<span class="token punctuation">:</span> performance_schema.memory
Status<span class="token punctuation">:</span> 26459600
...</span></code></pre>
  </div>
  <p>
   This statement is intended to help the DBA understand the effects
      that different Performance Schema options have on memory
      requirements. For a description of the field meanings, see
   <a class="xref" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
    Section 15.7.7.16, “SHOW ENGINE Statement”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
