文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>排重语句

排重语句

时间:2010-08-26  来源:snailshen

表demo是重复拷贝自dba_objects,有88万左右,不重复的是27323,没有索引
方法一:delete from demo a where a.rowid <> (select max(rowid) from demo b where
                                                                      b.object_id=a.object_id);
            耗时:几个小时以上
方法二: delete from demo where rowid in
              (select rid from
                          (select rowid rid,row_number() over(partition by object_id order by rowid) rn
                             from demo)
               where rn <> 1 );
   耗时:30秒
方法三: create table demo2 as
              select object_id,owner... from
                       (select demo.*,row_number() over(partition by object_id order by rowid) rn from demo)
                         where rn = 1;
              truncate table demo; insert into demo select * from demo2; drop table demo2;
共耗时: 10秒,适合大数据量的情况,产生更少回滚量;

 
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载