oracle:批量插入不同方案对比
实时测试的速度:
--48466条数据
--1.297
inline view更新法
inline view更新法就是更新一个临时建立的视图
update (select a.join_stateas join_state_a,b.join_stateas join_state_b
from t_join_situation a, t_people_info b where a.people_number=b.people_number
and a.year='2011' and a.city_number='M00000' and a.town_number='M51000'
) set join_state_a=join_state_b
括号里通过关联两表建立一个视图,set中设置好更新的字段。这个解决方法比写法较直观且执行速度快。但表B的主键一定要在where条件中,并且是以“=”来关联被更新表,否则报错误
--7.156
update t_join_situation aset a.join_state=(select b.join_statefrom t_people_info b
where a.people_number=b.people_number
and a.year='2011' and a.city_number='M00000' and a.town_number='M51000')
where exists (select 1 from t_people_info b
where a.people_number=b.people_number
and a.year='2011' and a.city_number='M00000' and a.town_number='M51000')
--3.281
begin
for crin (select a.rowid,b.join_statefrom t_join_situation a,t_people_info b
where a.people_number=b.people_number
and a.year='2011' and a.city_number='M00000' and a.town_number='M51000')loop
update t_join_situationset join_state=cr.join_statewhere
rowid = cr.rowid;
end loop;
end;
--1.641
merge into t_join_situation a
using t_people_info b
on (a.people_number=b.people_number
and a.year='2011' and a.city_number='M00000' and a.town_number='M51000')
when matched then update set a.join_state=b.join_state
oracle:批量插入不同方案对比的更多相关文章
- oracle批量插入优化方案
今天听DBA说如果从一个表批量查询出一批数据之后批量插入另外一张表的优化方案: 1)不写归档日志: 2)采用独占 关于insert /*+ append */我们需要注意以下三点: a.非归档模式下, ...
- oracle 批量插入-支持序列自增
1.创建表.序列 -- Create table create table test_batch ( id number not null, name ), account ) ) -- Create ...
- oracle批量插入優化方案
今天聽DBA説如果從一個表批量查詢出一批數據之後批量插入另外一張表的優化方案: 1)不寫歸檔日誌: 2)採用獨佔 關於insert /*+ append */我們需要注意以下三點: a.非歸檔模式下, ...
- Oracle 逐条和批量插入数据方式对比
创建测试表 create table base_users ( userid varchar2(16), username varchar2(32), passwd var ...
- SQL Server 批量插入数据方案 SqlBulkCopy 的简单封装,让批量插入更方便
一.Sql Server插入方案介绍 关于 SqlServer 批量插入的方式,有三种比较常用的插入方式,Insert.BatchInsert.SqlBulkCopy,下面我们对比以下三种方案的速度 ...
- 【MySQL】insert批量插入优化方案
对于一些数据量较大的系统,数据库面临的问题除了查询效率低下,还有就是数据入库时间长.特别像报表系统,每天花费在数据导入上的时间可能会长达几个小时或十几个小时之久.因此,优化数据库插入性能是很有意义的. ...
- mybatis在mysql和oracle批量插入不同
两者不同 1,批量插入 2,主键自增 3,分页不同 4,......待补充 批量插入 mysql: <insert id="batchinsertSelective" par ...
- android批量插入数据效率对比
对比在android中批量插入数据的3中方式对比(各插入1W条数据所花费的时间): 1. 一个一个插入 /** * 向表中插入数据 * * @param openHelper * @param app ...
- Oracle批量插入数据SQL语句太长出错:无效的主机/绑定变量名
Oracle数据库,用mybatic批量插入数据: <insert id="saveBatch" parameterType="io.renren.entity.N ...
随机推荐
- Java后台模拟发送http的get和post请求,并测试
个人学习使用:谨慎参考 1 Client类 import com.thoughtworks.gauge.Step; import com.thoughtworks.gauge.Table; impor ...
- Mycat 分片规则详解--固定 hash 分片
实现方式:该算法类似于十进制的求模运算,但是为二进制的操作,例如,取 id 的二进制低 10 位 与 1111111111 进行 & 运算 优点:这种策略比较灵活,可以均匀分配也可以非均匀分配 ...
- 笔记:Maven 依赖及配置详解
dependencies 配置节,主要用于配置项目依赖的其他包,其子节点 dependency 用来配置具体依赖包,有groupId.artifactId.version.scope等子节点来说明,配 ...
- trigger回调方法的实现
用传参实现trigger的回调: 点击btn1触发btn2的click事件并执行trigger中传入的回调方法 <body> <input type="button&quo ...
- poj-1131-(大数)八进制转化成十进制
Description Fractions in octal (base 8) notation can be expressed exactly in decimal notation. For e ...
- Linux下mysql的常用操作
Linux下mysql的常用操作: 显示数据库 show databases; 选择数据库 use 数据库名; 显示数据库中的表 show tables; 显示数据表的结构 describe 表名; ...
- /etc/nginx/nginx.conf配置文件详解
user nginx; #数值和cpu核数个数一致worker_processes 8; #worker与cpu绑定 worker_cpu_affinity 0001 0010 0100 1000 1 ...
- KVM之七:KVM克隆
1.在克隆虚拟机之前,必须先暂停或者停掉kvm 虚拟机.以虚拟机 snale 为例,先暂停虚拟机,如下 [root@kvm ~ ::]#virsh list Id 名称 状态 ------------ ...
- Python-turtle库知识小结(python绘图工具)
turtle:海龟(海龟库) Turtle库是Python语言中一个很流行的绘制图像的函数库 使用之前需要导入库:import turtle • turtle.setup(width,height,s ...
- linux分析、诊断及调优必备的“杀器”之二
先说明下,之所以同类内容分成多篇文章,不是为了凑篇数,而是为了便于自己和大家阅读,下面继续: 7.sar The sar command is used to collect, report, and ...