最近做做一些关于数据比对的东西,经常用到not in来比对,对于小的数据的情况那肯定是没有问题,not in是不能走索引的,如果表的数据很大的话根本就行不同,google了下用not exists来地带,效果很好
select * from tablename@dblink
where id not in(select id from tablename);
select * from tablename@tdblink a
where not exists(select 1 from tablename b where a.id=b.id);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16719800/viewspace-631458/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16719800/viewspace-631458/