OPTIMIZER_TRACE 表提供由优化器追踪功能生成的被追踪语句的信息。要启用追踪,请使用 optimizer_trace 系统变量。有关详细信息,请参阅 第 10.15 节,“追踪优化器”。The 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 Section 10.15, “Tracing the Optimizer”.
OPTIMIZER_TRACE 表具有以下列:The OPTIMIZER_TRACE table has these
columns:
QUERYQUERY被追踪语句的文本。The text of the traced statement.
TRACE追踪信息,格式为
JSON。The trace, inJSONformat.MISSING_BYTES_BEYOND_MAX_MEM_SIZE每个被记住的跟踪都是一个字符串,随着优化的进行会不断扩展并向其中附加数据。
optimizer_trace_max_mem_size变量设置所有当前被记住的跟踪所使用的总内存量的上限。如果达到该上限,当前跟踪将不会被扩展(因此是不完整的),且MISSING_BYTES_BEYOND_MAX_MEM_SIZE列将显示跟踪中缺失的字节数。Each remembered trace is a string that is extended as optimization progresses and appends data to it. Theoptimizer_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 theMISSING_BYTES_BEYOND_MAX_MEM_SIZEcolumn shows the number of bytes missing from the trace.INSUFFICIENT_PRIVILEGES如果跟踪查询使用了具有值为
DEFINER的SQL SECURITY的视图或存储过程,则可能除了定义者之外的用户被拒绝查看查询的跟踪。在这种情况下,跟踪显示为空,并且INSUFFICIENT_PRIVILEGES的值为 1。否则,该值为 0。If a traced query uses views or stored routines that haveSQL SECURITYwith a value ofDEFINER, 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 andINSUFFICIENT_PRIVILEGEShas a value of 1. Otherwise, the value is 0.