1.查看 profiling 是否开启:

show variables like 'profiling';

2.默认关闭,开启

set profiling=on;

4.查看执行过的语句

show profiles;

mysql--show Profile 分析--全局查询日志

5.选择一个 QueryID 进行下一步查询:

show profile cpu,block io for query 4;
 

 

mysql--show Profile 分析--全局查询日志

可以根据上面的内容进行分析:

当出现下面的 状态时 必须进行优化:

mysql--show Profile 分析--全局查询日志

group by 容易创建临时表 ;

 

全局查询日志:

这个功能推荐在测试中使用,开发中设置为off;

下面介绍使用:

1.开启,设置 日志显示方式为表格

set global general_log =1;

set global log_output='TABLE';

2.查看日志


select argument from mysql.general_log;
 

 

相关文章:

  • 2021-08-08
  • 2021-12-29
  • 2022-02-21
  • 2021-05-31
  • 2021-11-07
  • 2021-10-01
猜你喜欢
  • 2022-01-18
  • 2021-09-12
  • 2021-09-13
  • 2022-12-23
  • 2021-09-01
  • 2021-10-15
  • 2022-12-23
相关资源
相似解决方案