8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 30 MySQL sys Schema / 30.1 Prerequisites for Using the sys Schema
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

30.1 使用 sys 架构的先决条件30.1 Prerequisites for Using the sys Schema

在使用 sys 架构之前,必须满足本节所述的先决条件。Before using the sys schema, the prerequisites described in this section must be satisfied.

因为 sys 架构提供了一种访问 Performance Schema 的替代方式,因此必须启用 Performance Schema 才能使 sys 架构正常工作。请参见 第 29.3 节,“Performance Schema 启动配置”。Because the sys schema provides an alternative means of accessing the Performance Schema, the Performance Schema must be enabled for the sys schema to work. See Section 29.3, “Performance Schema Startup Configuration”.

要完全访问 sys 架构,用户必须具备以下权限:For full access to the sys schema, a user must have these privileges:

还需要对 sys 架构对象所依赖的对象拥有权限:It is also necessary to have privileges for the objects underlying the sys schema objects:

必须启用某些 Performance Schema 工具和消费者,并且(对于工具)进行计时,以充分利用 sys 架构的功能:Certain Performance Schema instruments and consumers must be enabled and (for instruments) timed to take full advantage of sys schema capabilities:

  • 所有 wait 工具All wait instruments

  • 所有 stage 工具All stage instruments

  • 所有 statement 工具All statement instruments

  • 所有事件的 xxx_current 和 xxx_history_long 消费者xxx_current and xxx_history_long consumers for all events

您可以使用 sys 架构本身来启用所有额外的工具和消费者:You can use the sys schema itself to enable all of the additional instruments and consumers:

CALL sys.ps_setup_enable_instrument('wait');
CALL sys.ps_setup_enable_instrument('stage');
CALL sys.ps_setup_enable_instrument('statement');
CALL sys.ps_setup_enable_consumer('current');
CALL sys.ps_setup_enable_consumer('history_long');
Note

对于 sys 模式的许多用途,默认的 Performance Schema 已经足够用于数据收集。启用上面提到的所有工具和消费者会影响性能,因此最好只启用您需要的额外配置。此外,请记住,如果启用了额外的配置,可以轻松地像这样恢复默认配置:For many uses of the sys schema, the default Performance Schema is sufficient for data collection. Enabling all the instruments and consumers just mentioned has a performance impact, so it is preferable to enable only the additional configuration you need. Also, remember that if you enable additional configuration, you can easily restore the default configuration like this:

CALL sys.ps_setup_reset_to_default(TRUE);