最小日志量的insert操作
--1.实验环境
SQL> conn scott/tiger
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.4.0
Connected as scott@howe
SQL> drop table record purge;
Table dropped
SQL> create table record(name varchar2(20),value number);
Table created
SQL> drop table t1;
Table dropped
SQL> create table t1 as select * from emp;
Table created
SQL> insert into t1 select * from t1;
14 rows inserted
SQL> insert into t1 select * from t1;
28 rows inserted
SQL> insert into t1 select * from t1;
56 rows inserted
SQL> insert into t1 select * from t1;
112 rows inserted
SQL> insert into t1 select * from t1;
224 rows inserted
SQL> insert into t1 select * from t1;
448 rows inserted
SQL> insert into t1 select * from t1;
896 rows inserted
SQL> insert into t1 select * from t1;
1792 rows inserted
SQL> insert into t1 select * from t1;
3584 rows inserted
SQL> insert into t1 select * from t1;
7168 rows inserted
SQL> select count(*) from t1;
COUNT(*)
----------
14336
SQL> commit;
Commit complete
SQL> --2.测试语句
SQL> --2.1nologging状态table
SQL> alter table t1 nologging;
Table altered
SQL> truncate table record;
Table truncated
SQL> insert into record(name,value) select 'no1',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert /*+ append */ into t1 select * from t1;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'no1',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into record(name,value) select 'no2',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert /*+ append */ into t1 select * from t1 nologging;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'no2',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into record(name,value) select 'no3',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into t1 select * from t1;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'no3',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into record(name,value) select 'no4',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into t1 select * from t1 nologging;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'no4',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> --2.2logging状态table
SQL> alter table t1 logging;
Table altered
SQL> insert into record(name,value) select 'log1',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert /*+ append */ into t1 select * from t1;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'log1',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into record(name,value) select 'log2',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert /*+ append */ into t1 select * from t1 nologging;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'log2',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into record(name,value) select 'log3',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into t1 select * from t1;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'log3',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into record(name,value) select 'log4',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> insert into t1 select * from t1 nologging;
14336 rows inserted
SQL> rollback;
Rollback complete
SQL> insert into record(name,value) select 'log4',value from v$sysstat where STATISTIC# =194;
1 row inserted
SQL> commit;
Commit complete
SQL> --3.分析及结论
SQL> select name,max(value)-min(value) redosize from record group by name order by 2;
NAME REDOSIZE
-------------------- ----------
no2 1128
no1 11380
log2 700248
log1 702272
log4 782996
no4 785136
no3 788168
log3 789528
8 rows selected
第二次测试
SQL> select count(*) from t1;
COUNT(*)
----------
1835008
SQL> select name,max(value)-min(value) redosize from record group by name order by 2;
NAME REDOSIZE
-------------------- ----------
no2 18680
no1 352092
log2 88943948
log1 89526160
no4 100242344
log3 100398632
log4 100788388
no3 106720044
最小日志量
第一 insert /*+ append */ into t1 select * from t1 nologging; --nologging
第二 insert /*+ append */ into t1 select * from t1; -- nologging
最大日志量
insert into t1 select * from t1; --t1 nologging
insert into t1 select * from t1;
insert into t1 select * from t1 nologging;
在t1属性为nologging或logging下,日志量基本相同
insert /*+ append */ into t1 select * from t1;
insert /*+ append */ into t1 select * from t1 nologging;
在t1表logging状态下,日志量基本相同 且是该状态下日志量最小的。
最小日志量的insert操作的更多相关文章
- Mysql备份系列(4)--lvm-snapshot备份mysql数据(全量+增量)操作记录
Mysql最常用的三种备份工具分别是mysqldump.Xtrabackup(innobackupex工具).lvm-snapshot快照.前面分别介绍了:Mysql备份系列(1)--备份方案总结性梳 ...
- 源码浅析:MySQL一条insert操作,会写哪些文件?包括UNDO相关的文件吗?
DML操作的大致流程 在解答上述疑惑之前,我们来梳理一下DML操作的大致流程: 1.语法解析.语义解析 2.生成执行计划 3.事务修改阶段 1) 激活事务,事务状态由not_active变为activ ...
- SQL Server 最小日志记录
SQL Server之所以记录事务日志,首要目的是为了把失败或取消的操作还原到最原始的状态,但是,并不是所有的操作都需要完全记录事务日志,比如,在一个空表上放置排他锁,把大量的数据插入到该空表中.即使 ...
- 多表insert操作详解
--1.无条件的多表insert all ; ; ; --没有条件,向多个目标表全量插入,必须有all insert all --不指定emp_1后面的列,也不指定values,那么emp_1中的所有 ...
- [转]SQLServer添加UPDATE回滚日志(update/delete/insert)
下面直接上代码(copy到你的数据库里面直接就可以运行): CREATE PROCEDURE [dbo].[SP_UPDATE_LOG] ) AS BEGIN SET NOCOUNT ON; IF N ...
- EBS oracle 批量导入更新MOQ(最小拆分量、采购提前期、最小订购量、最小包装量)
EXCEL的列:组织id,供应商编号,供应商地点,料号,最小拆分量.采购提前期.最小订购量.最小包装量 --采购导入更新MOQ四个值,若有为空的那列,会保留原来的值,不会去更新那列的值 PROCEDU ...
- mybatis 08: 返回主键值的insert操作 + 利用UUID获取字符串(了解)
返回主键值的insert操作 应用背景 图示说明 在上述业务背景下,涉及两张数据表的关联操作:用户表 + 用户积分表 传统操作:在对用户表执行完插入语句后,再次查询该用户的uid,将该uid作为外键, ...
- MyBatis魔法堂:Insert操作详解(返回主键、批量插入)
一.前言 数据库操作怎能少了INSERT操作呢?下面记录MyBatis关于INSERT操作的笔记,以便日后查阅. 二. insert元素 属性详解 其属性如下: parameterType ...
- IBatisNet:让insert操作返回新增记录的主键值
项目引用ibatis包: IBatisNet.Common.dll --文件版本1.6.2.0 IBatisNet.DataAccess.dll IBatisNet.DataMapper.dll 项目 ...
随机推荐
- 浅析JavaScript和PHP中三个等号(===)和两个等号(==)的区别
先做个简单的介绍,让先有个直观的认识 == equality 等同 === identity 恒等 == 两边值类型不同的时候,要先进行类型转换,再比较. === 不做类型转换,类型不同的一定不等. ...
- Python学习笔记整理(五)Python中的列表.
列表和字段,这两种类型几乎是Python所有脚本的主要工作组件.他们都可以在原处进行修改,可以按需求增加或缩短,而且包含任何种类的对象或者被嵌套. 一.列表 列表的主要属性: *任意对象的有序集合 从 ...
- nodejs javascript微信开发
1.当从第三方软件需要分享到微信的时候 需要给授权处理才能获得微信信息 比如 nickname 等昵称图像等 从第三方登陆跳转到微信分享页需要 shareurl = http://open.weixi ...
- [SDOI2008]仪仗队
P2158 [SDOI2008]仪仗队 题目描述 作为体育委员,C君负责这次运动会仪仗队的训练.仪仗队是由学生组成的N * N的方阵,为了保证队伍在行进中整齐划一,C君会跟在仪仗队的左后方,根据其视线 ...
- python的pyc和pyo文件
python并非完全是解释性语言,它是有编译的,先把源码py文件编译成pyc或者pyo,然后由python的虚拟机执行,相对于py文件来说,编译成pyc和pyo本质上和py没有太大区别,只是对于这个模 ...
- ServletConfig对象 【通过此对象获取到web.xml中的信息】
用途: 1)想让当前的Servlet读取一些在web.xml文件配置的初始化参数时, 可以使用ServletConfig对象,他是Servlet运 ...
- Keil C调试经验
我们使用Keil C调试某系统时积累的一些经验: 1.由于Keil C对中文支持不太好,因而会出现显示的光标与光标实际所在不一致的现象,这会对修改中文注释造成影响.在Windows2000下面 ...
- 【数位DP】 HDU 4734 F(x)
原题直通车:HDU 4734 F(x) 题意:F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 * 1, 求0.....B中F[x]<=F[A ...
- windows上安装winsshd
winsshd下载地址:http://www.bitvise.com/ssh-server-download 安装后默认配置即可使用:
- Delphi 把字符串读到流中的操作。
var FReQuestM := TMemoryStream FReQuestM.Write(PChar(FcVoucherXML)^, Length(FcVoucherXML)); 这样就读到流中了 ...