代码改变世界

mysql使用sys和performance_schema查看慢查询

  abce  阅读(170)  评论(0编辑  收藏  举报
1
2
3
4
5
6
7
8
9
10
11
12
13
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;

  

1
select * from sys.statement_analysis where db not in ('performance_schema', 'sys') order by avg_latency desc;  

  

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2018-11-23 exp导出数据时丢表
2016-11-23 python - 文件迭代
点击右上角即可分享
微信分享提示