sql中exists与in效率
来源:互联网 发布:wlan密码破解软件 编辑:程序博客网 时间:2024/05/19 18:00
1. 如果要查询的列上没有NULL值,NOT IN 和 NOT Exist效率
是一样的.
2. 跟beckhamboo说的基本类似:
当数据量较少时,not in执行速度比not exists快
反之,not exists较可取
3. 同样,处理 IN 和Exist 也有下面的规则:
内查询为小表,外查询为大表时,使用IN的效率高,例如:
select count(*) from bigtable
where id in(select id from smalltable)
效率高
select count(*) from bigtable
where exists ( select null from smalltable
where smalltable.id = bigtable.id )
效率低
反之,内查询为大表,外查询为小表时,使用Exist的效率高.
select count(*) from smalltable
where id in (select id from bigtable)
效率差一点
select count(*) from smalltable
where exists ( select null from bigtable
where smalltable.id = bigtable.id )
效率好一点.
- sql中exists与in效率
- SQL中EXISTS与IN的效率问题
- Sql中EXISTS与IN的效率问题
- Sql中EXISTS与IN的效率问题
- sql中 in , not in , exists , not exists效率分析
- sql中 in和exists的效率
- mysql中in与exists效率比较
- sql Exists in 文章1: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 效率比较和使用
- SQL里的EXISTS与in、not exists与not in 效率问题
- in和exists的区别与SQL执行效率分析
- in和exists的区别与SQL执行效率分析
- in和exists的区别与SQL执行效率分析
- in和exists的区别与SQL执行效率分析
- in和exists的区别与SQL执行效率分析
- jquery用法
- ASP.Net中自定义Http处理及应用之HttpModule篇
- [jBPM系列]jBPM 4.3 Demo Setup的安装部署
- 基于WinCE模拟器的应用程序调试(转)
- ifstream 与ofstream用法
- sql中exists与in效率
- 从底层了解ASP.NET体系结构
- Web报表中用switchCase实现不同条件自动计算不同的表达式
- 123
- Struts2 文件上传拦截器配置问题
- vi 命令
- 用InstallAnywhere打包Java程序包含MySQL数据库
- 属性不匹配。存在属性(Directory, Compressed),包括属性(0),不包括属性(Archive, Compressed, Encrypted)
- SQL操作