oracle高效率insert写法

来源:互联网 发布:java.lang.throwable 编辑:程序博客网 时间:2024/05/20 20:04

这里我们这边验证一个oracle非常规的高效率insert写法

--创建2个测试表hyper/hyperWcreate table hyper  (a int);create table hyperW (a int);
--插入100万条记录--注意:此处耗时严重declare i int:=1;begin  while i<=1000000 loop  insert into hyper values(i);  i:=i+1;  end loop;endcommit;

高效率插入100万数据

--高效率写法--从表hyper查询并插入数据到hyperW(见下图0.2s)alter table hyperW nologging; insert /*+ append */ into hyperW select * from hyper; commit--打开归档日志alter table hyperW logging;

高性能插入0.2s

原创粉丝点击