mysql优化-show profile

分类: MySQL

是什么?

mysql提供可以用来分析当前绘画中语句执行的资源消耗情况,可以用于sql的调优的测量;默认情况下,参数处于关闭状态,并保持最近15次的运行结果。

分析步骤

开启

show variables like 'profiling';
set profiling=on;

运行sql

mysql里面查看结果

show profiles;

通过以下分析sql完整的生命周期,x未上面的query_id

show profile cpu,block io for query x;

结论

如果出现如下4个之一,则表明有需要优化

converting HEAP to MyISAM查询结果太大,内存都不够用了往磁盘上搬了。
Creatimg tmp table 创建临时表(拷贝数据到临时表;用完再删除)
Copying to tmp table on disk 把内存中临时表复制到磁盘,危险!!!
locked

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注


Warning: error_log(/www/wwwroot/codegulu.cn/wp-content/plugins/spider-analyser/#log/log-1017.txt): Failed to open stream: Permission denied in /www/wwwroot/codegulu.cn/wp-content/plugins/spider-analyser/spider.class.php on line 2969