- 29.4.1 Performance Schema 事件计时29.4.1 Performance Schema Event Timing
- 29.4.2 Performance Schema 事件过滤29.4.2 Performance Schema Event Filtering
- 29.4.3 事件预过滤29.4.3 Event Pre-Filtering
- 29.4.4 按工具预过滤29.4.4 Pre-Filtering by Instrument
- 29.4.5 按对象预过滤29.4.5 Pre-Filtering by Object
- 29.4.6 按线程预过滤29.4.6 Pre-Filtering by Thread
- 29.4.7 按消费者预过滤29.4.7 Pre-Filtering by Consumer
- 29.4.8 示例消费者配置29.4.8 Example Consumer Configurations
- 29.4.9 为筛选操作命名仪器或消费者29.4.9 Naming Instruments or Consumers for Filtering Operations
- 29.4.10 确定哪些内容已被仪器化29.4.10 Determining What Is Instrumented
可以在运行时启用特定的性能模式功能,以控制发生哪些类型的事件收集。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.TABLESWHERE 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.