文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 10 优化 / 10.15 跟踪优化器 / 10.15.10 选择要跟踪的优化器功能
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

10.15.10 选择要跟踪的优化器功能10.15.10 Selecting Optimizer Features to Trace

优化器中的某些功能在语句优化和执行过程中可能会被多次调用,因此可能导致跟踪信息膨胀得不合理。它们包括: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 an N-table join, this could explore factorial(N) plans.

  • 范围优化器Range optimizer

  • 动态范围优化:在 EXPLAIN 输出中显示为 range checked for each record;每个外部行都会导致范围优化器重新运行。Dynamic range optimization: Shown as range checked for each record in EXPLAIN output; each outer row causes a re-run of the range optimizer.

  • 子查询:在子查询中,WHERE 子句可能会对每一行执行一次。Subqueries: A subquery in which the WHERE clause 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 this JOIN_TAB::SQL_SELECT is traced.

  • repeated_subselect:仅跟踪此Item_subselect的第一次执行。repeated_subselect: Only the first execution of this Item_subselect is traced.