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