您的位置:程序门 -> oracle -> 高级技术



高频率数据插入的问题,如果提高数据插入速度


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


高频率数据插入的问题,如果提高数据插入速度[已结贴,结贴人:yj1804]
发表于:2007-04-25 14:54:06 楼主
使用insert   /*+append*/   into   t   select   *   from   test2;
5   000   000记录只需要elapsed:   00:01:53.54就可以完成导入,但是如果数据不是从另外的表中导录,而是动态生成的。比如说通过java程序传入的。有什么办法可以达到同样的数据插入速度。
我尝试过forall,   append   hint   等技术,插入5   000   000记录最快也260秒左右,只有20000条/秒不到。不知道有什么办法还可以提升。我据的理论上既然insert   /*+append*/   into   t   select   *   from   test2;都可以达到40000多条/秒的速度,java程序插入也应该可以很接近这个速度啊,请高手指教
发表于:2007-04-25 15:05:051楼 得分:0
56.1 sql   statements   consuming   significant   database   time   were   found. 3sql   tuning
50.71 waits   on   event   "log   file   sync "   while   performing   commit   and   rollback   operations   were   consuming   significant   database   time. 1host   configuration
21.65 log   file   switch   operations   were   consuming   significant   database   time   while   waiting   for   checkpoint   completion. 2db   configuration
9.91 time   spent   on   the   cpu   by   the   instance   was   responsible   for   a   substantial   part   of   database   time. 1sql   tuning
4.84 waits   for   redo   log   buffer   space   were   consuming   significant   database   time. 1db   configuration
1host   configuration
4.19 wait   class   "network "   was   consuming   significant   database   time.
4.17 wait   event   "sql*net   more   data   from   client "   in   wait   class   "network "   was   consuming   significant   database   time. 3application   analysis
3.4 read   and   write   contention   on   database   blocks   was   consuming   significant   database   time.

上面是addm的报告,我对oracle不是很熟悉,不知道如何分析这个东西,对性能进行优化,请大家指教
发表于:2007-04-25 15:09:082楼 得分:100
插入5   000   000记录最快也260秒左右,这个时间包含了java程序动态生成数据的时间么?如果不是在服务器上做的话,是不是还有网络带宽耗费的时间。

发表于:2007-04-25 15:11:573楼 得分:0
网络是100m局域网,这个会有很大的影响么?
如果不计算其他的开销,纯数据在300mb左右
发表于:2007-04-25 15:14:214楼 得分:0
java程序动态生成数据的频率在每秒50000条以上,暂时来说是远超过插入速度。
发表于:2007-04-27 10:54:295楼 得分:0
问题已经解决。使用/*+append*/   必须和select   查询一起使用
direct-path   insert   supports   only   the   subquery   syntax   of   the   insert   statement,   not   the   values   clause.   for   more   information   on   the   subquery   syntax   of   insert   statements,   see   oracle   database   sql   reference.

java的sql语句改写成insert   /*   +append   */   into   tablename   select   要插入的值   from   dual后速度就上来了


快速检索

最新资讯
热门点击