优化器中的某些功能在语句优化和执行过程中可能会被多次调用,因此可能导致跟踪信息膨胀得不合理。它们包括:Some features in the optimizer can be invoked many times during statement optimization and execution, and thus can make the trace grow beyond reason. They are:
贪婪搜索:对于一个
N表连接,这可能会探索 factorial(N) 个计划。Greedy search: With anN-table join, this could explore factorial(N) plans.范围优化器Range optimizer
动态范围优化:在
EXPLAIN输出中显示为range checked for each record;每个外部行都会导致范围优化器重新运行。Dynamic range optimization: Shown asrange checked for each recordinEXPLAINoutput; each outer row causes a re-run of the range optimizer.子查询:在子查询中,
WHERE子句可能会对每一行执行一次。Subqueries: A subquery in which theWHEREclause may be executed once per row.
可以通过将optimizer_trace_features系统变量的一个或多个开关设置为OFF来排除这些功能的跟踪。以下是这些开关的列表:Those features can be excluded from tracing by setting one or more
switches of the
optimizer_trace_features system
variable to OFF. These switches are listed
here:
greedy_search:贪心搜索不被跟踪。greedy_search: Greedy search is not traced.range_optimizer:范围优化器不被跟踪。range_optimizer: The range optimizer is not traced.dynamic_range:仅跟踪此JOIN_TAB::SQL_SELECT上范围优化器的第一次调用。dynamic_range: Only the first call to the range optimizer on thisJOIN_TAB::SQL_SELECTis traced.repeated_subselect:仅跟踪此Item_subselect的第一次执行。repeated_subselect: Only the first execution of thisItem_subselectis traced.