最小日志量的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 项目 ...
随机推荐
- 在Web开发方面Java跟PHp八大对比
在Web开发方面Java跟PHp八大对比 <本文摘自百度经验,用来简单对比一下这两种语言> 一. 语言比较 PHP是解释执行的服务器脚本语言,首先php有简单容易上手的特点.语法和c语言比 ...
- 网站的优化----首页优化---app调取服务端数据
高并发经常会发生在有大活跃用户量来访问网站的某个点,例如用户高聚集的业务场景中,如:抢购,促销等.为了让用户流畅的访问网站,来根据自己的业务设计适合系统的处理方案. //对于APP网站首页数据,通常是 ...
- Activiti工作流学习-----基于5.19.0版本(4)
四.使用工作流开发 org.activiti.engine.ProcessEngine提供的Service作用在工作流引擎上面,如果所示是模仿一个公司简单的审批流程,你可以下载这个Demo:Activ ...
- uC/OS 的任务调度解析 (转)
uC/OS 的任务调度解析 1.任务调度器启动之后(初始化,主要是TCB的初始化),就可以创建任务,开始任务调度了,实际上第一个任务准确的说不是进行任务切换,而是进行启动当前最高优先级任务.uC/OS ...
- Android 颜色大全 (colors.xml )
<resources> <color name="pink">#ffc0cb</color><!--粉红色 --> <colo ...
- 性能测试 - some
1.日常业务中测试过的最大并发数,其QPS为多少? 答: 从服务端开发处得知线上某台机器单接口访问量为63万 因该接口为视频类访问接口,大多数接口集中于晚间时段.可计算QPS = 63万/8/3600 ...
- Unity GUI 用C#和Javascript写法的区别
以前都是用C#来写Unity的GUI.后来因为团队需要GUI必须用C#写. 其实一开始学Unity的GUI的时候我是想用C#来写,后来折腾了好久也没弄出来.反倒是这次不经意间就搞好了. C#和Java ...
- penetration testers渗透测试,hack,vnc,nat,
penetration testers渗透测试,hack,vnc,nat,
- wikioi3052 多米诺
题目描述 Description 一个矩形可以划分成M*N个小正方形,其中有一些小正方形不能使用.一个多米诺骨牌占用两个相邻的小正方形.试问整个区域内最多可以不重叠地放多少个多米诺骨牌且不占用任何一个 ...
- POJ2828---线段树与逆序数&&DUTOJ1210---逆序对构造排列
来看这样一道问题:http://acm.dlut.edu.cn/problem.php?id=1210 题目大意:对于一个1-n的排列,a1,a2,a3,a4...an我们把满足i < j,ai ...