博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[20161003]触发器与redo.txt
阅读量:7026 次
发布时间:2019-06-28

本文共 1820 字,大约阅读时间需要 6 分钟。

[20161003]触发器与redo.txt
--对于触发器,我个人认为对于dba是最讨厌的东西,它使得维护变得困难,不小心就陷入陷阱里面.
--我曾经跟开发讲过建立一个触发器相当于给表建立一个索引.除非万不得以不要建立触发器.
--昨天看了一个例子,重复作者的测试来说明问题:
http://orasql.org/2016/09/22/how-even-empty-trigger-increases-redo-generation/
1.环境:
SCOTT@test01p> @ ver1
PORT_STRING          VERSION    BANNER                                                                       CON_ID
-------------------- ---------- ---------------------------------------------------------------------------- ------
IBMPC/WIN_NT64-9.1.0 12.1.0.1.0 Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production      0
set feed on;
-- simple table:
create table xt_curr1 as select level a,level b from dual connect by level<=1e4;
-- same table but with empty trigger:
create table xt_curr2 as select level a,level b from dual connect by level<=1e4;
create or replace trigger tr_xt_curr2 before update on xt_curr2 for each row
begin
  null;
end;
/
set autot trace stat;
update xt_curr1 set b=a;
--commit;
set autot off;
set autot trace stat;
update xt_curr2 set b=a;
--commit;
set autot off;
set feed off
drop table xt_curr1 purge;
drop table xt_curr2 purge;
2.测试结果:
update xt_curr1 set b=a;
Statistics
----------------------------------------------------------
          8  recursive calls
        142  db block gets
         30  consistent gets
         18  physical reads
     960068  redo size
        862  bytes sent via SQL*Net to client
        824  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          3  sorts (memory)
          0  sorts (disk)
      10000  rows processed
update xt_curr2 set b=a;
Statistics
----------------------------------------------------------
         10  recursive calls
      20386  db block gets
         40  consistent gets
         19  physical reads
    4731300  redo size
        862  bytes sent via SQL*Net to client
        824  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          3  sorts (memory)
          0  sorts (disk)
      10000  rows processed
update xt_curr2 set b=a;
--可以发现即使是NULL的操作,也会导致redo增加不少.

转载地址:http://czmxl.baihongyu.com/

你可能感兴趣的文章
12篇学通C#网络编程——第四篇 TCP应用编程
查看>>
ASP.NET MVC的DropDownList
查看>>
B-tree vs hash_我思故我在_百度空间
查看>>
spring.net 结合简单三层实例
查看>>
phpcms(v9)添加模型
查看>>
LINQ 图解
查看>>
状态目标bfs+哈希表 + 三杯水
查看>>
MVC系统过滤器、自定义过滤器
查看>>
ASP.NET MVC+EF框架+EasyUI实现权限管理系列(20)-多条件模糊查询和回收站还原的实现...
查看>>
管理管理器深度探索QT窗口系统---布局篇
查看>>
Jekyll – 基于纯文本的开源静态网站 & 博客系统
查看>>
HTML <font> 标签
查看>>
NSString / NSMutableString 字符串处理
查看>>
3、C语言中一般类型的指针变量细解
查看>>
zookeeper
查看>>
IEnumerable和IEnumerator 详解 (转)
查看>>
web service接口测试工具选型
查看>>
Stage3d 由浅到深理解AGAL的管线vertex shader和fragment shader || 简易教程 学习心得 AGAL 非常非常好的入门文章...
查看>>
vi编辑器的使用方式
查看>>
JOIN与EXISTS(子查询)的效率研究
查看>>