12
返回列表 发新帖
楼主: onunix

请教下2个问题

[复制链接]
论坛徽章:
1
2010新春纪念徽章
日期:2010-03-01 11:20:05
11#
 楼主| 发表于 2013-5-2 09:55 | 只看该作者
本帖最后由 onunix 于 2013-5-2 16:07 编辑
Yong Huang 发表于 2013-4-28 22:30
So Oracle's direct path insert or load bypassing the SQL layer is completely irrelevant.

Not sure ...


谢谢Yong Huang,中间过了个五一节,回了趟老家,因此没有及时回复,答复一下: I assume the data you have in memory are in its own format, not data already in Oracle's PL/SQL arrays. How do you bulk insert?

我们打算使用数组插入,使用:
use the Oracle array interface and input many values with a single statement and a single call to OCIStmtExecute(). In this case you bind an array to an input placeholder, and the entire array can be passed at the same time, under the control of the iters parameter.

也就是说:

使用OCIBindByPos把内存数组(例如1000条记录)绑定,绑定完后,然后调用OCIStmtExecute() 进行一次性插入。(内存数据是以数组的形式存在的)。


详见相关说明:


OCI Array Interface
You can pass data to Oracle in various ways. You can execute a SQL statement repeatedly using the OCIStmtExecute() routine and supply different input values on each iteration. Alternatively, you can use the Oracle array interface and input many values with a single statement and a single call to OCIStmtExecute(). In this case you bind an array to an input placeholder, and the entire array can be passed at the same time, under the control of the iters parameter.
The array interface significantly reduces round-trips to Oracle when you need to update or insert a large volume of data. This reduction can lead to considerable performance gains in a busy client/server environment. For example, consider an application that needs to insert 10 rows into the database. Calling OCIStmtExecute() ten times with single values results in ten network round-trips to insert all the data. The same result is possible with a single call to OCIStmtExecute() using an input array, which involves only one network round-trip.
Note: When using the OCI array interface to perform inserts, row triggers in the database are fired as each row of the insert gets inserted.


使用道具 举报

回复
论坛徽章:
10
2011新春纪念徽章
日期:2011-02-18 11:43:332014年世界杯参赛球队: 加纳
日期:2014-05-28 11:43:47马上有对象
日期:2014-04-03 14:31:562013年新春福章
日期:2013-02-25 14:51:24蜘蛛蛋
日期:2013-01-30 15:04:41咸鸭蛋
日期:2013-01-21 09:45:36ITPUB 11周年纪念徽章
日期:2012-10-09 18:06:20ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15紫蛋头
日期:2011-06-22 14:32:28双子座
日期:2015-11-06 11:03:23
12#
发表于 2013-5-9 10:25 | 只看该作者
从主观上“臆断”,通过oci进行数组批量插入的时间“应该”比落地格式文件后批量load的速度要快,当然,这是一个可以被实验的案例。

使用道具 举报

回复
论坛徽章:
1
2010新春纪念徽章
日期:2010-03-01 11:20:05
13#
 楼主| 发表于 2013-5-9 11:40 | 只看该作者
本帖最后由 onunix 于 2013-5-10 10:38 编辑
cszxheap 发表于 2013-5-9 10:25
从主观上“臆断”,通过oci进行数组批量插入的时间“应该”比落地格式文件后批量load的速度要快,当然,这是 ...


i think so too , i  am trying to test it,and i found a array insert sample in the $ORACLE_HOME  diretory , and i try to compile it ,but showed errors

D:\app\yu\product\11.2.0\dbhome_1\OCI\samples>bcmake.bat
.
Please set environment variable BORLAND_HOME


使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表