not in与 id!=效率对比分析
来源:互联网 发布:镇江淘宝模特兼职招聘 编辑:程序博客网 时间:2024/06/08 17:46
not in的效率并不高,这个大家都知道,
但还有比not in效率更不高的。
今天查看慢查询记录文件,发现了一个神器的sql,具体写法就不说了,类似于这种:SELECT * from kills where id != '12323' and id != '13323' and id != '478732'
当时我好奇心就来了,这种为毛不写成select * from kills where id not in('12323', '13323', '478732')呢,难道第一种效率更高?如果不是,那不是吃力不讨好么?
然后我就试了下,我的数据库有记录五十八万条,然后分别执行这两者的话,第一个的执行效率一般在0.5S多,第二条在0.4S多。虽然快了并不多。
但是,后一种写起来更简单啊,更快啊,到底什么情况让有人写第一种呢(兴许是维护的过程中,后来者图省事儿,再后来者看,恩?前任都这么写的。就也这么写了。)
0 0
- not in与 id!=效率对比分析
- mysql中not in,not exists与join的is null效率对比
- NOT IN、JOIN、IS NULL、NOT EXISTS效率对比
- NOT IN、JOIN、IS NULL、NOT EXISTS效率对比
- sql中 in , not in , exists , not exists效率分析
- mysql中in与exists的性能与效率对比
- sql in与exist效率分析
- 【算法分析与设计】各种排序算法的效率对比
- SQL里的EXISTS与in、not exists与not in 效率比较和使用
- SQL里的EXISTS与in、not exists与not in 效率比较和使用
- SQL的EXISTS与in、not exists与not in 效率比较和使用
- SQL里的EXISTS与in、not exists与not in 效率比较和使用
- SQL里的EXISTS与in、not exists与not in 效率问题
- in,exists,not in ,not exists效率
- instancetype与id对比
- oracle中in和exists、not in和not exists的用法与效率
- sql Exists in 文章1:SQL里的EXISTS与in、not exists与not in 效率比较和使用
- DB2中exists与in的效率对比 — 5秒与21分钟的差距
- Struts2获取web资源的四种方式
- Makefile 语法中的自动化变量与函数
- 天声人語 20150811
- 20-01-其他对象API(System类)
- ZOJ 3541 - The Last Puzzle(区间dp)
- not in与 id!=效率对比分析
- bfs模板
- How to get file name when user select a file via <input type=“file” />?
- codeforce #200 div2 的水题三道
- N!
- DCE中从linux sendto转换为dce的关节部分
- **浅述IOS成员变量(Member variables)和实例变量(Instance varialbes)的区别**
- WPF Layout 系统概述——Measure
- vmware workstation