<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="system-variables-controlling-tracing">
      </a>
      10.15.2 System Variables Controlling Tracing
     </h3>
    </div>
   </div>
  </div>
  <p>
   The following system variables affect optimizer tracing:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_optimizer_trace">
       <code class="literal">
        optimizer_trace
       </code>
      </a>
      : Enables or
          disables optimizer tracing. See
      <a class="xref" href="optimizer-trace-system-variable.html" title="10.15.8 The optimizer_trace System Variable">
       Section 10.15.8, “The optimizer_trace System Variable”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_optimizer_trace_features">
       <code class="literal">
        optimizer_trace_features
       </code>
      </a>
      :
          Enables or disables selected features of the MySQL Optimizer,
          using the syntax shown here:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91524731"><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">SET</span> optimizer_trace_features<span class="token operator">=</span><span class="token keyword"><em class="replaceable">option</em></span><span class="token operator">=</span><span class="token keyword"><em class="replaceable">value</em></span><span class="token punctuation">[</span><span class="token punctuation">,</span><span class="token keyword"><em class="replaceable">option</em></span><span class="token operator">=</span><span class="token keyword"><em class="replaceable">value</em></span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">,</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>

<span class="token keyword"><em class="replaceable">option</em></span>: 
  {greedy_search <span class="token operator">|</span> range_optimizer <span class="token operator">|</span> dynamic_range <span class="token operator">|</span> repeated_subselect}

<span class="token keyword"><em class="replaceable">value</em></span>:
  {<span class="token keyword">on</span> <span class="token operator">|</span> <span class="token keyword">off</span> <span class="token operator">|</span> <span class="token keyword">default</span>}</code></pre>
     </div>
     <p>
      See
      <a class="xref" href="optimizer-features-to-trace.html" title="10.15.10 Selecting Optimizer Features to Trace">
       Section 10.15.10, “Selecting Optimizer Features to Trace”
      </a>
      , for more
          information on the effects of these.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_optimizer_trace_max_mem_size">
       <code class="literal">
        optimizer_trace_max_mem_size
       </code>
      </a>
      :
          Maximum amount of memory that can be used for storing all
          traces.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_optimizer_trace_limit">
       <code class="literal">
        optimizer_trace_limit
       </code>
      </a>
      : The
          maximum number of optimizer traces to be shown. See
      <a class="xref" href="tuning-trace-purging.html" title="10.15.4 Tuning Trace Purging">
       Section 10.15.4, “Tuning Trace Purging”
      </a>
      , for more information.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_optimizer_trace_offset">
       <code class="literal">
        optimizer_trace_offset
       </code>
      </a>
      :
          Offset of the first trace shown. See
      <a class="xref" href="tuning-trace-purging.html" title="10.15.4 Tuning Trace Purging">
       Section 10.15.4, “Tuning Trace Purging”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="server-system-variables.html#sysvar_end_markers_in_json">
       <code class="literal">
        end_markers_in_json
       </code>
      </a>
      : If set
          to
      <code class="literal">
       1
      </code>
      , causes the trace to repeat the key
          (if present) near the closing bracket. This also affects the
          output of
      <a class="link" href="explain.html#explain-execution-plan" title="Obtaining Execution Plan Information">
       <code class="literal">
        EXPLAIN
          FORMAT=JSON
       </code>
      </a>
      in those versions of MySQL which support
          this statement. See
      <a class="xref" href="end-markers-in-json-system-variable.html" title="10.15.9 The end_markers_in_json System Variable">
       Section 10.15.9, “The end_markers_in_json System Variable”
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
