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

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 29 MySQL Performance Schema / 29.4 Performance Schema Runtime Configuration
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

29.4 性能模式运行时配置29.4 Performance Schema Runtime Configuration

可以在运行时启用特定的性能模式功能,以控制发生哪些类型的事件收集。Specific Performance Schema features can be enabled at runtime to control which types of event collection occur.

性能模式设置表包含关于监控配置的信息:Performance Schema setup tables contain information about monitoring configuration:

mysql> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
       WHERE TABLE_SCHEMA = 'performance_schema'
       AND TABLE_NAME LIKE 'setup%';
+-------------------+
| TABLE_NAME        |
+-------------------+
| setup_actors      |
| setup_consumers   |
| setup_instruments |
| setup_objects     |
| setup_threads     |
+-------------------+

您可以检查这些表的内容以获取有关性能模式监控特性的相关信息。如果您拥有 UPDATE 权限,您可以通过修改设置表来更改性能模式操作,从而影响监控的方式。有关这些表的更多详细信息,请参阅 第 29.12.2 节,“性能模式设置表”。You can examine the contents of these tables to obtain information about Performance Schema monitoring characteristics. If you have the UPDATE privilege, you can change Performance Schema operation by modifying setup tables to affect how monitoring occurs. For additional details about these tables, see Section 29.12.2, “Performance Schema Setup Tables”.

setup_instruments 和 setup_consumers 表分别列出了可以收集事件的工具,以及实际收集事件信息的消费者类型。其他设置表允许进一步修改监控配置。第 29.4.2 节 “性能模式事件过滤” 讨论了如何修改这些表以影响事件收集。The setup_instruments and setup_consumers tables list the instruments for which events can be collected and the types of consumers for which event information actually is collected, respectively. Other setup tables enable further modification of the monitoring configuration. Section 29.4.2, “Performance Schema Event Filtering”, discusses how you can modify these tables to affect event collection.

如果有必须在运行时使用 SQL 语句进行的 Performance Schema 配置更改,并且希望这些更改在每次服务器启动时生效,请将语句放入文件中,并在启动服务器时将 init_file 系统变量设置为该文件的名称。如果您有多个监控配置,每个配置都用于生成不同类型的监控,例如日常服务器健康监控、事件调查、应用行为故障排除等,这种策略也会很有用。将每个监控配置的语句放入各自的文件中,并在启动服务器时将适当的文件指定为 init_file 值。If there are Performance Schema configuration changes that must be made at runtime using SQL statements and you would like these changes to take effect each time the server starts, put the statements in a file and start the server with the init_file system variable set to name the file. This strategy can also be useful if you have multiple monitoring configurations, each tailored to produce a different kind of monitoring, such as casual server health monitoring, incident investigation, application behavior troubleshooting, and so forth. Put the statements for each monitoring configuration into their own file and specify the appropriate file as the init_file value when you start the server.