oracle in和exists区别

in和exists

 http://oraclemine.com/sql-exists-vs-in/

https://www.techonthenet.com/oracle/exists.php

 https://www.techrepublic.com/article/oracle-tip-understand-the-difference-between-in-and-exists-in-subqueries/

exists

1)exists条件中存在数据时sql引擎停止处理

2)子查询结果集大时比in快

3)null可通过exists条件比较

4)子查询根据外查询逐个执行(子查询遍历外查询的所有结果)

5)exists先外查询再子查询,大部分情况下exists快,因为可以使用索引。但

子查询结果小时in性能更好。

in

1)sql引擎比较in条件中所有值

2)子集结果小时比exists快

3)null不能通过in比较

4)in=inside to outside 先子查询再外查询

猜你喜欢

转载自www.cnblogs.com/cslj2013/p/11456052.html