OPTIMIZER_TRACE table provides
information produced by the optimizer tracing capability for
traced statements. To enable tracking, use the
optimizer_trace system variable.
For details, see
Internals: Tracing the Optimizer.
OPTIMIZER_TRACE table has these
The text of the traced statement.
The trace, in
Each remembered trace is a string that is extended as optimization progresses and appends data to it. The
optimizer_trace_max_mem_sizevariable 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
MISSING_BYTES_BEYOND_MAX_MEM_SIZEcolumn shows the number of bytes missing from the trace.
If a traced query uses views or stored routines that have
SQL SECURITYwith a value of
DEFINER, 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
INSUFFICIENT_PRIVILEGEShas a value of 1. Otherwise, the value is 0.