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

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

29.4.3 事件预过滤29.4.3 Event Pre-Filtering

预过滤由性能模式执行,并具有适用于所有用户的全局效果。预过滤可以应用于事件处理的生产者或消费者阶段:Pre-filtering is done by the Performance Schema and has a global effect that applies to all users. Pre-filtering can be applied to either the producer or consumer stage of event processing:

  • 要在生产者阶段配置预过滤,可以使用几个表:To configure pre-filtering at the producer stage, several tables can be used:

    • setup_instruments 指示哪些工具可用。在此表中禁用的工具无论其他与生产相关的设置表内容如何,都不会生成事件。在此表中启用的工具允许生成事件,但需受其他表内容的影响。setup_instruments indicates which instruments are available. An instrument disabled in this table produces no events regardless of the contents of the other production-related setup tables. An instrument enabled in this table is permitted to produce events, subject to the contents of the other tables.

    • setup_objects 控制 Performance Schema 是否监视特定的表和存储程序对象。setup_objects controls whether the Performance Schema monitors particular table and stored program objects.

    • threads 指示是否为每个服务器线程启用了监控。threads indicates whether monitoring is enabled for each server thread.

    • setup_actors 决定新前台线程的初始监控状态。setup_actors determines the initial monitoring state for new foreground threads.

  • 要在消费者阶段配置预过滤,请修改 setup_consumers 表。这决定事件被发送到的目标。setup_consumers 也会隐含地影响事件的生成。如果某个事件没有被发送到任何目标(也就是说,它从未被消费),Performance Schema 将不会生成它。To configure pre-filtering at the consumer stage, modify the setup_consumers table. This determines the destinations to which events are sent. setup_consumers also implicitly affects event production. If a given event is not sent to any destination (that is, it is never consumed), the Performance Schema does not produce it.

对任何这些表的修改会立即影响监控,但修改 setup_actors 表除外,它仅影响修改后创建的前台线程,而不影响现有线程。Modifications to any of these tables affect monitoring immediately, with the exception that modifications to the setup_actors table affect only foreground threads created subsequent to the modification, not existing threads.

当你更改监控配置时,Performance Schema 不会清空历史表。已收集的事件会保留在当前事件表和历史表中,直到被更新的事件取代。如果你禁用仪器,可能需要等待一段时间,事件才会被新的感兴趣事件取代。或者,可以使用 TRUNCATE TABLE 来清空历史表。When you change the monitoring configuration, the Performance Schema does not flush the history tables. Events already collected remain in the current-events and history tables until displaced by newer events. If you disable instruments, you might need to wait a while before events for them are displaced by newer events of interest. Alternatively, use TRUNCATE TABLE to empty the history tables.

在进行检测更改后,你可能想要截断汇总表。通常,这样做的效果是将汇总列重置为 0 或NULL,而不是删除行。这可以让你清除已收集的值并重新开始聚合。例如,在你进行了运行时配置更改之后,这可能会非常有用。各个汇总表部分中记录了对这种截断行为的例外情况。After making instrumentation changes, you might want to truncate the summary tables. Generally, the effect is to reset the summary columns to 0 or NULL, not to remove rows. This enables you to clear collected values and restart aggregation. That might be useful, for example, after you have made a runtime configuration change. Exceptions to this truncation behavior are noted in individual summary table sections.

以下各节描述了如何使用特定表来控制 Performance Schema 的预过滤。The following sections describe how to use specific tables to control Performance Schema pre-filtering.