几百万条数据啊。
那要做索引,不过做一次索引也挺费时间的,
还有sql语句不要用in拉

解决方案 »

  1.   

    用这种方式速度还不错的。
     create index i_id on test1(id) nologging
      

  2.   

    两点想法:1.
    create index i_id on test1(id) nologging;alter table test2 cache;delete test1 where exists (select 1 from test2 where test1.id=test2.id);2.
    create table temp_t nologging as 
    select * from test1 
    where not exists (select 1 from test2 where test1.id=test2.id);truncate table test1;insert /*+ append*/ into test1 select * from temp_t;drop table temp_t;
      

  3.   

    create index i_id1 on test1(id) nologging
    create index i_id2 on test2(id) nologging
    delete  from test1  where exists(select 1 from test2 where test1.id = test2.id)