赞
踩
表a 小表 ,表b 大表
select c from a where c in (select c from b) 效率低
select c from a where exists (select 1 from b where a.c=b.c) 效率高
select c from b where c in (select c from a) 效率高
select c from b where exists (select 1 from a where a.c=b,c) 效率低 通过b 表循环
exists
foreach x in ( select * from b )
loop
if ( exists ( select null from a where b.c = a.c )
then
OUTPUT THE RECORD
end if
end loop
表 b 不可避免的要被完全扫描一遍
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。