大概有一千多万行的数据要删除,
类似如此:delete from usuage t where t.func ='CCC2'||t.func ='CCC1'------很简单的一句,但是结果太多。要求比较快速的删除。
不要重建表,重建索引的那种。
备份表的时候试过这个:create table usage_bak as select * from usage  感觉蛮快
那我可不可以用这个: create table usage_bak as select * from usage where t.func not in('CCB7','CCB8','CCB9','CCC1','CCC2')
本人菜鸟,求指导。

解决方案 »

  1.   


    --你可以试试现将需要的数据备份出来,然后truncate 原表,再将数据导回去create table usuage_bak 
       as select * from usuage t where t.func not in('CCC2','CCC1');truncate table usuage;insert into usuage select * from usuage_bak;
    commit;
      

  2.   

    “不要重建表,重建索引的那种”
    那你就老老实实使用delete删除,慢慢等吧。
      

  3.   


    thanks,删除了1000W条记录大约用时不到3分钟,不错。