undo change vector size oracle,Oracle技术之临时表的undo生成

临时表的redo生成要比普通表少的多,但是undo的产生并不比普通表少。

通过一个简单的例子说明:

SQL> create global temporary table t_temp

2  (id number, name varchar2(30))

3  on commit preserve rows;

表已创建。

SQL> create table t_normal

2  (id number, name varchar2(30));

表已创建。

SQL> select sid

2  from v$mystat

3  where rownum = 1;

SID

----------

133

SQL> select value

2  from v$statname a, v$sesstat b

3  where a.statistic# = b.statistic#

4  and a.name = 'undo change vector size '

5  and b.sid = 133;

未选定行

SQL> select value

2  from v$statname a, v$sesstat b

3  where a.statistic# = b.statistic#

4  and a.name = 'undo change vector size'

5  and b.sid = 133;

VALUE

----------

3988

SQL> insert into t_normal

2  select rownum, object_name

3  from dba_objects;

已创建49081行。

SQL> commit;

提交完成。

SQL> select value

2  from v$statname a, v$sesstat b

3  where a.statistic# = b.statistic#

4  and a.name = 'undo change vector size'

5  and b.sid = 133;

VALUE

----------

135232

SQL> insert into t_temp

2  select rownum, object_name

3  from dba_objects;

已创建49081行。

SQL> commit;

提交完成。

SQL> select value

2  from v$statname a, v$sesstat b

3  where a.statistic# = b.statistic#

4  and a.name = 'undo change vector size'

5  and b.sid = 133;

VALUE

----------

254240

SQL> select 254240 - 135232 temp_table, 135232 - 3988 normal_table from dual;

TEMP_TABLE NORMAL_TABLE

---------- ------------

119008       131244

可以看到,临时表和普通表产生的undo数据没有太多的差别,而实际上临时表的插入产生的redo信息也是undo信息对应的redo。

SQL> insert /*+ append */ into t_temp

2  select *

3  from t_temp;

已创建49081行。

SQL> commit;

提交完成。

SQL> select value

2  from v$statname a, v$sesstat b

3  where a.statistic# = b.statistic#

4  and a.name = 'undo change vector size'

5  and b.sid = 133;

VALUE

----------

254408

SQL> insert /*+ append */ into t_normal

2  select *

3  from t_normal;

已创建49081行。

SQL> commit;

提交完成。

SQL> select value

2  from v$statname a, v$sesstat b

3  where a.statistic# = b.statistic#

4  and a.name = 'undo change vector size'

5  and b.sid = 133;

VALUE

----------

256468

SQL> select 254408 - 254240 temp_table, 256468 - 254408 normal_table from dual;

TEMP_TABLE NORMAL_TABLE

---------- ------------

168         2060

对于append方式插入,普通表和临时表都会产生少量的undo,而临时表相对会更少一些。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值