mysql使用sys和performance_schema查看慢查询
2022-11-23 14:07 abce 阅读(164) 评论(0) 编辑 收藏 举报select schema_name, format_pico_time(total_latency) total_latency, exec_count, format_pico_time(total_latency/exec_count) latency_per_call, query_sample_text from sys.x$statements_with_runtimes_in_95th_percentile as t1 join performance_schema.events_statements_summary_by_digest as t2 on t2.digest = t1.digest where schema_name not in ( 'performance_schema', 'sys' ) order by ( total_latency / exec_count ) desc;
select * from sys.statement_analysis where db not in ('performance_schema', 'sys') order by avg_latency desc;