该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_instrumentation
is the highest level consumer. Ifglobal_instrumentation
isNO
, 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_instrumentation
isYES
, the Performance Schema maintains information for global states and also checks thethread_instrumentation
consumer.thread_instrumentation
is checked only ifglobal_instrumentation
isYES
. Otherwise, ifthread_instrumentation
isNO
, 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_instrumentation
isYES
, 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_current
table. IfYES
, it enables wait event collection and the Performance Schema checks theevents_waits_history
andevents_waits_history_long
consumers.events_waits_history
is not checked ifevent_waits_current
isNO
. Otherwise, anevents_waits_history
value ofNO
orYES
disables or enables collection of wait events in theevents_waits_history
table.events_waits_history_long
is not checked ifevent_waits_current
isNO
. Otherwise, anevents_waits_history_long
value ofNO
orYES
disables or enables collection of wait events in theevents_waits_history_long
table.
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_current
table. IfYES
, it enables stage event collection and the Performance Schema checks theevents_stages_history
andevents_stages_history_long
consumers.events_stages_history
is not checked ifevent_stages_current
isNO
. Otherwise, anevents_stages_history
value ofNO
orYES
disables or enables collection of stage events in theevents_stages_history
table.events_stages_history_long
is not checked ifevent_stages_current
isNO
. Otherwise, anevents_stages_history_long
value ofNO
orYES
disables or enables collection of stage events in theevents_stages_history_long
table.
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_current
table. IfYES
, it enables statement event collection and the Performance Schema checks theevents_statements_history
andevents_statements_history_long
consumers.events_statements_history
is not checked ifevents_statements_current
isNO
. Otherwise, anevents_statements_history
value ofNO
orYES
disables or enables collection of statement events in theevents_statements_history
table.events_statements_history_long
is not checked ifevents_statements_current
isNO
. Otherwise, anevents_statements_history_long
value ofNO
orYES
disables or enables collection of statement events in theevents_statements_history_long
table.
statements_digest
消费者要求
global_instrumentation
或
不YES
检查。不依赖于语句事件消费者,因此您可以获取每个摘要的统计信息,而无需在 中收集统计信息
events_statements_current
,这在开销方面是有利的。相反,您可以在
events_statements_current
没有摘要的情况下获得详细的陈述(DIGEST
和
DIGEST_TEXT
列是
NULL
)。
有关语句摘要的更多信息,请参阅 第 22.10 节,“性能模式语句摘要”。