1、Oracle Delete操作会产生redo log,undo log,即使delete 语句中加上nologging 参数,还是会记录日志的,这样保证了数据安全性,利于rollback。为了不使undo表空间被撑爆,可能需要分批提交,以下是分批提交语句:
declare
cnt number(10):=0;
i number(10):=0;
begin
select count(0) from scott.bigtable where id>1000000;
for i in 1..trunc(cnt/50000)+1 loop
delete from scott.bigtable where id >1000000 and rownum<=50000;
commit;
end loop;
end;
/
2、Oracle Delete 操作不会降低高水位线,而每次查询还是会扫描高水位线下面所有的数据,这样查询效率不会因为数据delete掉之后,而提高查询效率,除非通过压缩表的空间来降低高水位线。
查询高水位线语句,其中blocks表示高水位线:</