1,id 表的读取顺序,多表关联查询时,1, id值越大,则优先执行 2,值相等,则顺序加载
2,select_type
在这里插入图片描述
3,table
查询的是哪个表
4,type
工作中常见的
5,possible_keys 可能应用在该表中的索引
6,key 实际用到的索引
7,key_len 索引中使用的字节数
8,ref
9,rows
10,extra 额外的
举例:创建复合索引 cos1,cos2,cos3
where cosl=”ac” order cos3 desc;
这样extra就显示Using filesort。 意思是创建3个复合索引,实际只使用到两个索引。
where cosl=”ac” order ,cos2,cos3 desc;
这样extra就不显示Using filesort。意思是创建3个复合索引,实际3个索引都被使用到+
10-2
Using temporary
10-3 Using index
1,如果sql语句中使用范围,那后面的排序会失效
优化 where c = 1 and com>1 order by d desc