该setup_consumers表列出了可用的消费者类型以及哪些已启用:
mysql> SELECT * FROM performance_schema.setup_consumers;
+--------------------------------+---------+
| NAME | ENABLED |
+--------------------------------+---------+
| events_stages_current | NO |
| events_stages_history | NO |
| events_stages_history_long | NO |
| events_statements_current | YES |
| events_statements_history | NO |
| events_statements_history_long | NO |
| events_waits_current | NO |
| events_waits_history | NO |
| events_waits_history_long | NO |
| global_instrumentation | YES |
| thread_instrumentation | YES |
| statements_digest | YES |
+--------------------------------+---------+
修改setup_consumers表以影响消费者阶段的预过滤并确定事件发送到的目的地。要启用或禁用消费者,请将其ENABLED值设置为
YES或NO。
对
setup_consumers表的修改会立即影响监控。
如果禁用消费者,则服务器不会花时间维护该消费者的目的地。例如,如果您不关心历史事件信息,请禁用历史消费者:
UPDATE performance_schema.setup_consumers
SET ENABLED = 'NO'
WHERE NAME LIKE '%history%';
表中的消费者设置
setup_consumers形成了从高到低的层次结构。以下原则适用:
与消费者关联的目的地不会收到任何事件,除非性能模式检查消费者并且消费者已启用。
一个消费者只有在它依赖的所有消费者(如果有的话)都被启用时才会被检查。
如果一个消费者没有被选中,或者被选中但被禁用,那么依赖它的其他消费者也不会被选中。
依赖消费者可能有自己的依赖消费者。
如果事件不会发送到任何目的地,则性能模式不会产生它。
The following lists describe the available consumer values. For discussion of several representative consumer configurations and their effect on instrumentation, see Section 22.4.8, “Example Consumer Configurations”.
global_instrumentationis the highest level consumer. Ifglobal_instrumentationisNO, it disables global instrumentation. All other settings are lower level and are not checked; it does not matter what they are set to. No global or per thread information is maintained and no individual events are collected in the current-events or event-history tables. Ifglobal_instrumentationisYES, the Performance Schema maintains information for global states and also checks thethread_instrumentationconsumer.thread_instrumentationis checked only ifglobal_instrumentationisYES. Otherwise, ifthread_instrumentationisNO, it disables thread-specific instrumentation and all lower-level settings are ignored. No information is maintained per thread and no individual events are collected in the current-events or event-history tables. Ifthread_instrumentationisYES, the Performance Schema maintains thread-specific information and also checksevents_consumers.xxx_current
These consumers require both
global_instrumentation and
thread_instrumentation to be
YES or they are not checked. If checked,
they act as follows:
events_waits_current, ifNO, disables collection of individual wait events in theevents_waits_currenttable. IfYES, it enables wait event collection and the Performance Schema checks theevents_waits_historyandevents_waits_history_longconsumers.events_waits_historyis not checked ifevent_waits_currentisNO. Otherwise, anevents_waits_historyvalue ofNOorYESdisables or enables collection of wait events in theevents_waits_historytable.events_waits_history_longis not checked ifevent_waits_currentisNO. Otherwise, anevents_waits_history_longvalue ofNOorYESdisables or enables collection of wait events in theevents_waits_history_longtable.
These consumers require both
global_instrumentation and
thread_instrumentation to be
YES or they are not checked. If checked,
they act as follows:
events_stages_current, ifNO, disables collection of individual stage events in theevents_stages_currenttable. IfYES, it enables stage event collection and the Performance Schema checks theevents_stages_historyandevents_stages_history_longconsumers.events_stages_historyis not checked ifevent_stages_currentisNO. Otherwise, anevents_stages_historyvalue ofNOorYESdisables or enables collection of stage events in theevents_stages_historytable.events_stages_history_longis not checked ifevent_stages_currentisNO. Otherwise, anevents_stages_history_longvalue ofNOorYESdisables or enables collection of stage events in theevents_stages_history_longtable.
These consumers require both
global_instrumentation and
thread_instrumentation to be
YES or they are not checked. If checked,
they act as follows:
events_statements_current, ifNO, disables collection of individual statement events in theevents_statements_currenttable. IfYES, it enables statement event collection and the Performance Schema checks theevents_statements_historyandevents_statements_history_longconsumers.events_statements_historyis not checked ifevents_statements_currentisNO. Otherwise, anevents_statements_historyvalue ofNOorYESdisables or enables collection of statement events in theevents_statements_historytable.events_statements_history_longis not checked ifevents_statements_currentisNO. Otherwise, anevents_statements_history_longvalue ofNOorYESdisables or enables collection of statement events in theevents_statements_history_longtable.
statements_digest消费者要求
global_instrumentation或
不YES检查。不依赖于语句事件消费者,因此您可以获取每个摘要的统计信息,而无需在 中收集统计信息
events_statements_current,这在开销方面是有利的。相反,您可以在
events_statements_current没有摘要的情况下获得详细的陈述(DIGEST和
DIGEST_TEXT列是
NULL)。
有关语句摘要的更多信息,请参阅 第 22.10 节,“性能模式语句摘要”。