大量数据快速插入方法探究[nologging+parallel+append]
2016-06-29 22:05
645 查看
大量数据快速插入方法探究快速插入千万级别的数据,无非就是nologging+parallel+append。
参考指标:insert动作完成的实际时间。
没有关闭日志,所以时间是最长的。
发现日志对插入的影响很大,加nologging时间明显大幅缩短;当然这个表没有索引、约束等,这里暂不考究。
这里在3的基础上加上并行,性能基本达到极限,1.5千万数据插入时间控制在3S左右。并行在服务器性能支持的情况下,可以加大并行参数。
1 环境搭建
构建一个千万级别的源表,向一个空表insert操作。参考指标:insert动作完成的实际时间。
SQL> drop table test_emp cascadeconstraints purge; Table dropped. SQL> create table test_emp as select *from emp; Table created. SQL> begin 2 for i in 1..10 loop 3 insert into test_emp select *from test_emp; --批量dml,建议forall 4 end loop; 5 end; 6 / PL/SQL procedure successfully completed. SQL> select count(*) from test_emp; COUNT(*) ---------- 14336 SQL> begin 2 for i in 1..10 loop 3 insert into test_emp select *from test_emp; 4 end loop 5 ; 6 end; 7 / PL/SQL procedure successfully completed. SQL> select count(*) from test_emp; COUNT(*) ---------- 14680064 --1.5千万级别
2 only append
SQL> set timing on SQL> show timing timing ON SQL> insert /*+ append */ into test_goalselect * from test_emp; 14680064 rows created.Elapsed: 00:00:20.72
没有关闭日志,所以时间是最长的。
3 append+nologging
SQL> truncate table test_goal; Table truncated. Elapsed: 00:00:00.11 SQL> insert /*+ append */ into test_goalselect * from test_emp nologging; 14680064 rows created.Elapsed: 00:00:04.82
发现日志对插入的影响很大,加nologging时间明显大幅缩短;当然这个表没有索引、约束等,这里暂不考究。
4 append+nologging+parallel
SQL> truncate table test_goal; Table truncated. Elapsed: 00:00:00.09 SQL> insert /*+ parallel(2) append */into test_goal select * from test_emp nologging; 14680064 rows created.Elapsed: 00:00:02.86
这里在3的基础上加上并行,性能基本达到极限,1.5千万数据插入时间控制在3S左右。并行在服务器性能支持的情况下,可以加大并行参数。
相关文章推荐
- jquery append 动态添加的元素事件on 不起作用的解决方案
- JavaScript利用append添加元素报错的解决方法
- jquery在ie7下选择器的问题导致append失效的解决方法
- jQuery使用append在html元素后同时添加多项内容的方法
- jquery append()方法与html()方法的区别及使用介绍
- append和appendTo的区别以及appendChild用法
- 解决Jquery向页面append新元素之后事件的绑定问题
- C#使用Parallel类进行多线程编程实例
- jquery 追加元素append、prepend、before、after用法与区别分析
- python list中append()与extend()用法分享
- python使用append合并两个数组的方法
- python列表操作之extend和append的区别实例分析
- Python列表append和+的区别浅析
- 关于oracle的NOLOGGING
- nologging与append测试
- StringBuffer使用append提示String concatenation as argument to 'StringBuffer.append()' call
- RxJava(ReactiveX,Observable)的一些大白话
- 第二届IEEE高端计算机控制国际会议
- 嵌入式计算机 power pc 开发板
- ops ora-600[kccsbck_first]错误