<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="information-schema-optimizer-trace-table">
      </a>
      28.3.19 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045079462448">
  </a>
  <p>
   The
   <a class="link" href="information-schema-optimizer-trace-table.html" title="28.3.19 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table">
    <code class="literal">
     OPTIMIZER_TRACE
    </code>
   </a>
   table provides
      information produced by the optimizer tracing capability for
      traced statements. To enable tracking, use the
   <a class="link" href="server-system-variables.html#sysvar_optimizer_trace">
    <code class="literal">
     optimizer_trace
    </code>
   </a>
   system variable.
      For details, see
   <a class="xref" href="optimizer-tracing.html" title="10.15 Tracing the Optimizer">
    Section 10.15, “Tracing the Optimizer”
   </a>
   .
  </p>
  <p>
   The
   <a class="link" href="information-schema-optimizer-trace-table.html" title="28.3.19 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table">
    <code class="literal">
     OPTIMIZER_TRACE
    </code>
   </a>
   table has these
      columns:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       QUERY
      </code>
     </p>
     <p>
      The text of the traced statement.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TRACE
      </code>
     </p>
     <p>
      The trace, in
      <code class="literal">
       JSON
      </code>
      format.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       MISSING_BYTES_BEYOND_MAX_MEM_SIZE
      </code>
     </p>
     <p>
      Each remembered trace is a string that is extended as
          optimization progresses and appends data to it. The
      <a class="link" href="server-system-variables.html#sysvar_optimizer_trace_max_mem_size">
       <code class="literal">
        optimizer_trace_max_mem_size
       </code>
      </a>
      variable sets a limit on the total amount of memory used by
          all currently remembered traces. If this limit is reached, the
          current trace is not extended (and thus is incomplete), and
          the
      <code class="literal">
       MISSING_BYTES_BEYOND_MAX_MEM_SIZE
      </code>
      column shows the number of bytes missing from the trace.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       INSUFFICIENT_PRIVILEGES
      </code>
     </p>
     <p>
      If a traced query uses views or stored routines that have
      <code class="literal">
       SQL SECURITY
      </code>
      with a value of
      <code class="literal">
       DEFINER
      </code>
      , it may be that a user other than
          the definer is denied from seeing the trace of the query. In
          that case, the trace is shown as empty and
      <code class="literal">
       INSUFFICIENT_PRIVILEGES
      </code>
      has a value of 1.
          Otherwise, the value is 0.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
