用于过滤操作的名称可以根据需要指定得具体或通用。要表示单个仪器或消费者,请完整指定其名称:Names given for filtering operations can be as specific or general as required. To indicate a single instrument or consumer, specify its name in full:
UPDATE performance_schema.setup_instruments SET ENABLED = 'NO' WHERE NAME = 'wait/synch/mutex/myisammrg/MYRG_INFO::mutex'; UPDATE performance_schema.setup_consumers SET ENABLED = 'NO' WHERE NAME = 'events_waits_current';
要指定一组仪器或消费者,请使用匹配组成员的模式:To specify a group of instruments or consumers, use a pattern that matches the group members:
UPDATE performance_schema.setup_instruments SET ENABLED = 'NO' WHERE NAME LIKE 'wait/synch/mutex/%'; UPDATE performance_schema.setup_consumers SET ENABLED = 'NO' WHERE NAME LIKE '%history%';
如果使用模式,应选择匹配所有感兴趣项目且不匹配其他项目的模式。例如,要选择所有文件 I/O 仪器,最好使用包含整个仪器名称前缀的模式:If you use a pattern, it should be chosen so that it matches all the items of interest and no others. For example, to select all file I/O instruments, it is better to use a pattern that includes the entire instrument name prefix:
... WHERE NAME LIKE 'wait/io/file/%';
模式 '%/file/%' 会匹配名称中任何位置包含 '/file/' 元素的其他仪器。更不合适的是模式 '%file%',因为它会匹配名称中任何位置包含 'file' 的仪器,例如 wait/synch/mutex/innodb/file_open_mutex。A pattern of '%/file/%' matches other
instruments that have an element of '/file/'
anywhere in the name. Even less suitable is the pattern
'%file%' because it matches instruments with
'file' anywhere in the name, such as
wait/synch/mutex/innodb/file_open_mutex.
要检查某个模式匹配哪些仪器或消费者名称,请执行一个简单的测试:To check which instrument or consumer names a pattern matches, perform a simple test:
SELECT NAME FROM performance_schema.setup_instruments WHERE NAME LIKE 'pattern'; SELECT NAME FROM performance_schema.setup_consumers WHERE NAME LIKE 'pattern';
有关支持的名称类型的信息,请参见 29.6 节,“性能模式仪器命名约定”。For information about the types of names that are supported, see Section 29.6, “Performance Schema Instrument Naming Conventions”.