最小日志量的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 项目 ...
随机推荐
- Repeater绑定数据库,使用AspNetPager进行分页
分页是Web中经常遇到的功能,分页主要有真分页和假分页. 所谓真分页是指:每一页显示多少数据,就从数据库读多少数据: 假分页是指:一次性从数据库读取所有数据,然后再进行分页. 这两种分页方式区别在于从 ...
- TextField控件详解2
//初始化textfield并设置位置及大小 UITextField *text = [[UITextField alloc]initWithFrame:CGRectMake(20, 20, 130, ...
- pfsense 2.2RC下的L2TP配置
还不有测试完成,不过,基本上应该差不多了. 主要参考以下文档: http://blog.sina.com.cn/s/blog_541a3cf10101ard3.html http://thepract ...
- photoshop sdk
http://blogs.adobe.com/photoshop/2013/09/introducing-adobe-generator-for-photoshop-cc.html
- CentOs6.5中安装和配置vsftp简明
这篇文章主要介绍了CentOs6.5中安装和配置vsftp简明教程,需要的朋友可以参考下 一.vsftp安装篇 复制代码代码如下: # 安装vsftpdyum -y install vsftp ...
- windows下重命名一个带有前缀"."dot字符的名字的错误问题
如果用正常的右键重命名那么肯定会报错的,比如: 有一个名为project的文件,我想把它命名为.project,加了个前缀dot.然后window就报错了,弹出个对话框让“你必须输入一个文件名”.它可 ...
- vbox安装mac os x
http://zhiwei.li/text/2013/12/%E5%9C%A8virtualbox4-3-4%E4%B8%AD%E5%AE%89%E8%A3%85mavericks/ http://g ...
- Hadoop开发遇到的问题之reduce卡住
遇到的问题描述:在hadoop上面执行程序,程序运行之后能够正常执行.一切似乎都是正常的,然而过了一段时间之后程序便开始阻塞直到程序超时退出(如下). 14/08/19 21:17:51 INFO m ...
- (greedy)Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- Dynamic Binding & Static Binding
Reference: JavaPoint BeginnerBook What is Binding Connecting a method call to the method body is kno ...