show variables like 'profiling'
默认关闭,使用前需要开启
开启
set profiling=on;
运行 SQL
select `id` % 10 from `emp` group by `id` % 10 limit 150000;
select id%20 from emp group by id%20 order by id;
4. 查看运行结果:
show profiles;
5. 诊断SQL :
show profile cpu, block io for query 上一步前面的问题 SQL 数字号码
示例
show profile cpu, block io for query 3;
参数备注:
日常开发需要注意的事项
converting HEAP to MyISAM 查询结果太大,内存都不够用了往磁盘上面搬了
Create tmp table 创建临时表
拷贝数据到临时表用完再删除
示例
Copying to tmp table on disk 把内存中的临时表复制到磁盘, 危险!!!!
bocked