1.查看performance_schema
show variables like 'Performance_schema%';
2.查看存储引擎的状态显示总内存大小
show engine performance_schema status;
3.进入performance_schema,执行select语句setup_开头的表
use performance_schema;
show tables like 'setup\_%';
4.监控前台线程,前台线程是与客户端连接关联的线程。(那些用户需要收集信息)
select * from setup_actors;
5.那些对象需要收集信息,比如mysql表
select * from setup_objects;
6.计时定义表
select * from setup_timers;
7.收集仪器,每一个功能点都会有仪器的事件,开始和结束,然后开启那个仪器,就会收集那个仪器的数据
select * from setup_instruments;
8.那些仪器的分类需要收集
select * from setup_consumers;
9.看帮助文档
select * from table_io_waits_summary_by_table;
10.校验instruments是否启用
select * from setup_instruments where name like 'wait/io/table%';
- truncate table_io_waits_summary_by_table表
truncate table table_io_waits_summary_by_table;
12.执行employees数据库
select * from employees.employees;
13.查object_schema,object_name,count_star,sum_timer_wait字段
select object_schema,object_name,count_star,sum_timer_wait
from table table_io_waits_summary_by_table
where object_schema='employees'
and object_name='employees';
14.执行以下查询
select sleep(5);
15.查询sys用户下的statments_with_runtimes_in_95th_percentile
select * from sys.statments_with_runtimes_in_95th_percentile\G