MySQL的慢查询、explain、show profile及SQL优化

 

1、MySQL的慢查询、explain、show profile及SQL优化

https://www.cnblogs.com/linyue09/p/9869163.html

 

2、MySQL优化

1、查看 profile 开启情况
    select @@profiling;
    开启profile:set profiling = 1;
    
2、查看执行的 SQL 列表
    show profiles;
    
3、查询指定 ID 的执行详细信息
    show profile for query Query_ID;
    
4、获取 CPU、 Block IO 等信息
    show profile block io,cpu for query Query_ID;

    show profile cpu,block io,memory,swaps,context switches,source for query Query_ID;

    show profile all for query Query_ID;

 

posted @ 2023-06-26 14:56  古语云  阅读(27)  评论(0编辑  收藏  举报