设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 数据 手机
当前位置: 首页 > 站长学院 > MySql教程 > 正文

MySQL数据库ORDER BY优化总结(为排序使用索引)(2)

发布时间:2019-12-25 22:26 所属栏目:115 来源:站长网
导读:-wherea=constandb=constorderbyc -wherea=constandbconsstorderbyb,c (3) 不能使用索引进行排序 -orderbyaasc,bdesc,cdesc/*排序不一致*/ -whereg=constorderbyb,c/*丢失a索引*/ -wherea=constorderbyc/*丢失b索引

-where a= const and b= const order by c 

-where a= const and b> consst order by b,c 

(3) 不能使用索引进行排序

-order by a asc,b desc, c desc /*排序不一致*/ 

-where g=const order by b,c /*丢失a索引*/ 

-where a=const order by c /*丢失b索引*/ 

-where a=const order by a,d /*d不是索引一部分*/ 

-where a in (....) order by b,c /*对于排序来说,多个相等条件也是范围查询*/ 

3. filesort有两种排序算法:双路排序和单路排序

(编辑:ASP站长网)

网友评论
推荐文章
    热点阅读