mysql 的 show profile 相关属性
例如:首先 show profiles; 获取所有的查询 sql 记录,然后执行下面语句:
show profile CPU,BLOCK IO for query 10;
显示第10条 sql 的详细查询记录,这里的第 10 条记录就是上面 show profile 的 第 10 条 sql
在这么多的属性中,CPU 和 BLOCK IO 是最主要的两个属性
在查询的过程中,绝对不要让一下四种情况的出现:
例如下面这个记录中就有 creating tmp table 花了 2 秒多的时间: