« 文本导入导出速度测试 »
Tools » http://www.anysql.net/tools/text_export_import_testing.html 2009-03-22将文本导出速度提高了25%后, 想和exp对比一下, 就再仔细测试了一把. 测试服务器为笔记本, 客户端运行在同一台笔记本上, 测试用表有8个字段, 360万条记录, 包括了字符数字及日期字段, 表结构如下所示:
Name Null? Type
------------------------ -------- ------------------
EMPNO NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
用exp工具测试了数次, 将buffer参数调到和ociuldr一样大小, 导出的时间大约在20到24秒. 用ociuldr导出成逗号分隔时, 生成186MB的数据文件, 用时30秒(数次测试都是同样时长), 日志信息如下:
0 rows exported at 2009-03-22 16:56:23
500000 rows exported at 2009-03-22 16:56:27
1000000 rows exported at 2009-03-22 16:56:30
1500000 rows exported at 2009-03-22 16:56:35
2000000 rows exported at 2009-03-22 16:56:39
2500000 rows exported at 2009-03-22 16:56:43
3000000 rows exported at 2009-03-22 16:56:47
3500000 rows exported at 2009-03-22 16:56:52
3670044 rows exported at 2009-03-22 16:56:53
output file uldrdata.txt closed at 3670044 rows.
用ociuldr导出成固定长度时, 生成220MB的数据文件, 用时31或32秒(数次测试都是同样时长), 日志信息如下:
0 rows exported at 2009-03-22 17:01:38
500000 rows exported at 2009-03-22 17:01:42
1000000 rows exported at 2009-03-22 17:01:46
1500000 rows exported at 2009-03-22 17:01:50
2000000 rows exported at 2009-03-22 17:01:54
2500000 rows exported at 2009-03-22 17:01:59
3000000 rows exported at 2009-03-22 17:02:03
3500000 rows exported at 2009-03-22 17:02:08
3670044 rows exported at 2009-03-22 17:02:09
output file uldrdata.txt closed at 3670044 rows.
从测试来看, ociuldr的速度还是不能和exp比, 只达到了75%左右. 考虑到导出成文本文件除字符串外的数据类型都要作类型转换, 这个速度已经很不错了, 可以接受这个事实. 后面再来测试一下用sqlldr装载的速度. 分别用普通模式和Direct模式测试分隔符和固定长度情况下的速度, 对文本导入, 有了更好的理解了. 下面是测试结果:
-- Normal + Separator
Elapsed time was: 00:00:32.73
CPU time was: 00:00:13.57
-- Normal + Fixed Length
Elapsed time was: 00:00:29.83
CPU time was: 00:00:13.23
-- Direct + Separator
Elapsed time was: 00:00:29.83
CPU time was: 00:00:13.23
-- Direct + Fixed Length
Elapsed time was: 00:00:17.42
CPU time was: 00:00:08.93
普通模式下, 是不是固定长度格式并不是很重要, 速度差不多, 但在Direct模式下, 固定长度格式才发挥了速度的优势, 可以看到已经比exp的速度还快了.


Recent Comments