mysql8 mysql5.5_mysql8.0组合索引与5.5版本有什么差异?

谢邀.......这个问题邀请我后我观望了好久好久(期待出现巨巨解答)

等了这么久了还没有解答,于是我就看了下8.0的manual

下面的内容节选自mysql8.0 manual,版权归属oracle8.3.6 Multiple-Column IndexesIf a multiple-column index exists on col1 and col2, the appropriate rows can be fetched directly. If separate single-column indexes exist on col1 and col2, the optimizer attempts to use the Index Merge optimization (see Section 8.2.1.3, “Index Merge Optimization”), or attempts to find the most restrictive index by deciding which index excludes more rows and using that index to fetch the rows.

If the table has a multiple-column index, any leftmost prefix of the index can be used by the optimizer to look up rows. For example, if you have a three-column index on (col1, col2, col3), you have indexed search capabilities on (col1), (col1, col2), and (col1, col2, col3).

MySQL cannot use the index to perform lookups if the columns do not form a leftmost prefix of the index. Suppose that you have the SELECT statements shown here:

这里明确指出最左匹配原则只有(1,2,3)中的(1) (1,2)(1,2,3)才能用上组合索引......

但是也应该注意到,condition的顺序是不会导致组合索引的使用的(顶多影响选择哪个组合索引),所以这里为何没用上索引.......同样迷惑ing

5.5mysql手边没有手册,无法解答

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值