首页 > 数据库 > 数据库开发技术 > 删除重复数据的一种高效的方法
方法二: 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秒,适合大数据量的情况,产生更少回滚量;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3898/viewspace-790239/ ,如需转载,请注明出处,否则将追究法律责任。