--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操作的更多相关文章

  1. Mysql备份系列(4)--lvm-snapshot备份mysql数据(全量+增量)操作记录

    Mysql最常用的三种备份工具分别是mysqldump.Xtrabackup(innobackupex工具).lvm-snapshot快照.前面分别介绍了:Mysql备份系列(1)--备份方案总结性梳 ...

  2. 源码浅析:MySQL一条insert操作,会写哪些文件?包括UNDO相关的文件吗?

    DML操作的大致流程 在解答上述疑惑之前,我们来梳理一下DML操作的大致流程: 1.语法解析.语义解析 2.生成执行计划 3.事务修改阶段 1) 激活事务,事务状态由not_active变为activ ...

  3. SQL Server 最小日志记录

    SQL Server之所以记录事务日志,首要目的是为了把失败或取消的操作还原到最原始的状态,但是,并不是所有的操作都需要完全记录事务日志,比如,在一个空表上放置排他锁,把大量的数据插入到该空表中.即使 ...

  4. 多表insert操作详解

    --1.无条件的多表insert all ; ; ; --没有条件,向多个目标表全量插入,必须有all insert all --不指定emp_1后面的列,也不指定values,那么emp_1中的所有 ...

  5. [转]SQLServer添加UPDATE回滚日志(update/delete/insert)

    下面直接上代码(copy到你的数据库里面直接就可以运行): CREATE PROCEDURE [dbo].[SP_UPDATE_LOG] ) AS BEGIN SET NOCOUNT ON; IF N ...

  6. EBS oracle 批量导入更新MOQ(最小拆分量、采购提前期、最小订购量、最小包装量)

    EXCEL的列:组织id,供应商编号,供应商地点,料号,最小拆分量.采购提前期.最小订购量.最小包装量 --采购导入更新MOQ四个值,若有为空的那列,会保留原来的值,不会去更新那列的值 PROCEDU ...

  7. mybatis 08: 返回主键值的insert操作 + 利用UUID获取字符串(了解)

    返回主键值的insert操作 应用背景 图示说明 在上述业务背景下,涉及两张数据表的关联操作:用户表 + 用户积分表 传统操作:在对用户表执行完插入语句后,再次查询该用户的uid,将该uid作为外键, ...

  8. MyBatis魔法堂:Insert操作详解(返回主键、批量插入)

    一.前言    数据库操作怎能少了INSERT操作呢?下面记录MyBatis关于INSERT操作的笔记,以便日后查阅. 二. insert元素 属性详解   其属性如下: parameterType  ...

  9. IBatisNet:让insert操作返回新增记录的主键值

    项目引用ibatis包: IBatisNet.Common.dll --文件版本1.6.2.0 IBatisNet.DataAccess.dll IBatisNet.DataMapper.dll 项目 ...

随机推荐

  1. 服务器是windows时tomcat无法打印所有日志配置修改

    Tomcat运行仅一天磁盘空间突然就增加了很多,发现是日志文件太大了,修改tomcat的日志配置即可. 查看目录所占空间大小: ? 1 [root@XXX webapps]du -sh 清理方法: ? ...

  2. 几个个实用的PHP代码片段【自己备份】

    检查服务器是否是 HTTPS 这个PHP代码片段能够读取关于你服务器 SSL 启用(HTTPS)信息. if ($_SERVER['HTTPS'] != "on") { echo ...

  3. dede轮播图

    DEDEcms 里面有个自带的轮播图调用: 模版 ------> 广告管理 --------> 增加一个新广告 ----进入后的界面 填写后 点击 代码获取相应的JS调用代码:或者织梦CM ...

  4. 【Beta】Scrum10

    Info 最后一次Scrum会议(补发) 时间:2017.01.03 21:35 时长:20min 地点:大运村1号公寓5楼楼道 类型:日常Scrum会议 NXT:-- Task Report Nam ...

  5. github恢复

    一.查看修改日志信息 1)git log:显示最近到最远的提交日志 添加参数--pretty=oneline:查看简单的日志信息. 二.进行恢复到先前版本 1)在Git中,HEAD表示当前版本,上一个 ...

  6. Linux Shell逻辑运算符和表达式详解

    Shell 逻辑运算符涉及以下几种类型,只要适当选择,可以解决我们很多复杂的判断,达到事半功倍效果. 一.逻辑判断1.关于文件与目录的逻辑判断-f 常用.判断『文件』是否为普通文件,比如: if [ ...

  7. redis maxmemory设置

    关于maxmemory的设置,如果redis的应用场景是作为db使用,那不要设置这个选项,因为db是不能容忍丢失数据的. 如果作为cache使用,则可以启用这个选项(其实既然有淘汰策略,那就是cach ...

  8. hdu4623:crime 数学优化dp

    鞍山热身赛的题,也是去年多校原题 题目大意: 求n个数的排列中满足相邻两个数互质的排列的数量并取模 当时的思路就是状压dp.. dp[i][state]  state用二进制记录某个数是否被取走,i ...

  9. acdream1412:2-3 trees 组合数dp

    题意: 给出一个标准2-3树的叶子节点(最底层节点)个数 L,求2-3数的形成方案数并取余 分析: 如果有L个叶子枚举 每个 可以使x*2+y*3=L 的 x y 那么在最底层就有  c(x+y,x) ...

  10. c语言条件表达式误区1

    #include <stdio.h> #include <stdlib.h> //综合1 和 2我们知道牢记条件表达式中常量写在左边的语法规则 以防因为疏忽造成难以查找的错误 ...