1、假设index(a,b,c)
| where语句 | 索引是否被使用 |
|---|---|
| where a =3 | Y,使用到a |
| where a =3 and b =5 | Y,使用到a,b |
| where a =3 and b =5 and c =4 | Y,使用到a,b,c |
| where b =3 或者 where b=3 and c=4 或者 where c=4 | N |
| where a =3 and c=5 | 使用到a,但是c不可以,因为b中间断了 |
| where a =3 and b>4 and c=5 | 使用到a和b,c不能用在范围之后,因为b断了 |
| where a =3 and b like ‘kk%’ and c =4 | a能用,b能用,c不能用 |
