-
insert into......select 语句的优化
优化前:
insert into table1 select * from table2;
commit;
优化后:
alter table table1 nologging;
insert /*+ append */ into table1 select * from table2;
commit;
alter table table1 logging;
原理:在使用了baiappend选项以后,insert数据会直接加到表的最后面,du而不会在表的空zhi闲块中插入数据。
使用daoappend会增加数据插入的速度。
/*+APPEND*/的作用是在表的高水位上分配空间,不再使用表的extent中的空余空间
append 属于direct insert,归档模式下append+table nologging会大量减少日志,非归档模式append会大量减少日志,append方式插入只会产生很少的undo
不去寻找 freelist 中的free block , 直接在table HWM 上面加入数据。