mysql索引是否失效问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36373262/article/details/79978549
id int   phone varchar 两个都有索引

问题,看那些索引失效,哪些索引没有失效

id in (1,2)        y
id in ('1','2')    y
id in (1,'2')      y
id in ('1',2)      y

name in (1,2)       n
name in ('1','2')   y
name in (1,'2')     n
name in ('1',2)     n

id like ('%1' and '2')    y
id like ('1%' and '2')    y
id like ('1' and '%2')    y
id like ('1' and '2%')    y

id like ('%1' and 2)     y
id like ('1%' and 2)     y
id like (1 and '%2')     y
id like (1 and '2%')     y

name like ('%1' and '2')        y
name like ('1%' and '2')        y
name like ('1' and '%2')        y
name like ('1' and '2%')        y

name like ('%1' and 2)          y
name like ('1%' and 2)          y
name like (1 and '%2')          y
name like (1 and '2%')          y

name like '%1'          n
name like '1%'          y

id like '%1'            n
id like '1%'            y
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页