比如表1:有1000万条数据
表2有2000万条数据,现在表2和表1里面有500万条数据相同,请问我该怎样快速的得到那不同的1500万条数据?

解决方案 »

  1.   

    not existsselect t2.* from t2 where not exists(select 1 from t1 where t1.关键字 = t2.关键字)select t2.* from t2 where not exists(select 1 from t1 where 你说的不同的条件)
      

  2.   

    或者minus
    select t2.* from t2 
    minus 
    select t1.* from t1视执行计划选用
      

  3.   

    这应该不是查询慢的问题,是你要求返回的记录太多的问题,你返回了将近3/4 的数据,ORACLE 肯定是对表进行全表扫描或者快速全索引扫描.oracle 把时间耗在扫描硬盘读取数据上了
      

  4.   

    执行计划show出来啊,说又什么用。
      

  5.   

    一般都是not exists 或者 minus....F5看执行计划,走索引的就是最快的...
      

  6.   

    select * from t2,t1
    where t2.col = t1.col(+)
    and t1.col is null
      

  7.   

    趋向于minus
    应该自带函数最给力吧