1:insert into table(aa)
select aa from table1 wheren aa not in (select aa from table2)
这样的追加语句速度怎么那么慢啊?还有什么更好的方法来追加吗?假如table表中有10万记录,table1表中有10000,在table2中有100000记录.执行上面的语句速度要几个小时,晕死了.
2:另外:like 在数据库内执行速度比较快,但在程序中使用发现速度狂慢(尤其记录多的时候),请问还有什么好的方法解决啊?

解决方案 »

  1.   

    1:insert into table(aa)
    select aa from table1 wheren not exists(select * from table2 where table2.aa=table1.aa)
      

  2.   

    用in﹑not in來查詢速度降低好多的﹐而且你的數據表又很大﹐是不是有其他辦法可以改不用in,not in我覺得你應該改用臨時表來處理一下
      

  3.   

    zhsunson(sunson) 的方法能在一定程度上提高速度!用in的话比较适合数据量小的情况!
      

  4.   

    not exists 速度上还是不快的。