mysql-一些常用命令

show global status;

距离上次数据库启动一些连接的统计情况

show global status like 'Innodb_rows_%';

针对某一些字段进行查询

 

查询order by是走了内存排,还是外部磁盘的临时表排

1、先看下innodb_rows_read在哪个数据库下,在

information_schema

或者

performance_schema

 

2、

set optimizer_trace ='enabled=on';

 

3、select VARIABLE_VALUE into @a from information_schema.session_status where variable_name like "%rows_read%";

 

4、

select id,name from t_user order by name limit 10;

执行相应的语句

 

5、

select * from information_schema.optimizer_trace \G

 

 

终点看这个部分。

如果number_of_tmp_files =0说明排序在内存完成;

如果不是0就是通过外部临时文件完成

posted @ 2019-09-08 14:34  会飞的企鹅吧  阅读(119)  评论(0编辑  收藏  举报