2019-12-09
[if !vml]
[endif]
[if !supportLists]1.1.1.[endif]字符串不加单引号导致类型转换,索引失效
下列哪个sql语句可以用到索引
[if !supportLists]?[endif]EXPLAIN SELECTSQL_NO_CACHE * FROM emp WHERE name=123;
[if !supportLists]?[endif]EXPLAIN SELECT SQL_NO_CACHE* FROM emp WHERE name='123';
[if !vml]
[endif]
[if !supportLists]?[endif]name=123发生类型转换,索引失效。
[if !supportLists]?[endif]设计实体类属性时,一定要与数据库字段类型相对应,否则,就会出现类型转换的情况。
[if !supportLists]1.1.2.[endif]小总结
假设index(a,b,c)
Where语句索引是否被使用
where a =3Y,使用到a
where a = 3 and b =5Y,使用到a,b
where a = 3 and b =5 and c = 4Y,使用到a,b,c
where b = 3 或者where b = 3 and c =4或者where c =4N
where a = 3 and c =5使用到a, 但是c不可以,b中间断了
where a = 3 and b> 4 and c = 5使用到a和b, c不能用在范围之后,b断了
where a is null andb is not null
is null支持索引 但是is not null 不支持,所以 a 可以使用索引,但是b不可以使用
where a <>3
不能使用索引
where abs(a)=3不能使用 索引
【2019-12-09】where a = 3 and blike 'kk%' and c = 4Y,使用到a,b,c
where a = 3 and blike '%kk' and c = 4Y,只用到a
where a = 3 and blike '%kk%' and c = 4Y,只用到a
where a = 3 and blike 'k%kk%' and c = 4Y,使用到a,b,c
[if !supportLists]1.2.[endif]一般性建议
[if !supportLists]?[endif]对于单键索引,尽量选择过滤性更好的索引(例如:手机号,邮件,身份证)
[if !supportLists]?[endif]在选择组合索引的时候,过滤性最好的字段在索引字段顺序中,位置越靠前越好。
推荐阅读
- C/C++|#ifndef/#define/#endif使用详解
- VMLogin.cc|全新薅羊毛软件神器(VMLogin中文版防关联软件)
- 2019-12-09|2019-12-09 择食
- 浏览器指纹|facebook养号技术细节软件批量注册fb耐用号fb广告号fb商城号VMlogin中文版教程
- 浏览器指纹|multilogin浏览器教程VMLogin.cc防关联浏览器官方教程什么是破解版林肯法球浏览器教程
- 浏览器指纹|Multilogin/VMLogin/亚马逊测评FaceBook广告联盟Affiliate多账号防关联批量注册养号技巧教程工具
- 浏览器指纹|亚马逊测评教程_亚马逊刷好评流程_亚马逊刷单技巧_亚马逊真人测评VMLogin中文版防关联浏览器教程
- 浏览器指纹|Luminati使用教程配置代理使用指南VMLogin中文版反指纹浏览器Multilogin
- 多账号防关联|批量养社交账号批量养号注册技术教程利用VMLogin中文版防关联反指纹浏览器
- 多账号防关联|防关联浏览器怎么样防关联软件工具服务器 批量养号注册登陆教程 配合VMlogin中文版反指纹防关联浏览器使用教程