[转帖]Try 11g OLTP compress_MQ, Tuxedo及OLTP讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MQ, Tuxedo及OLTP讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4093 | 回复: 0   主题: [转帖]Try 11g OLTP compress        下一篇 
ulee@land
注册用户
等级:上尉
经验:769
发帖:55
精华:1
注册:2012-12-17
状态:离线
发送短消息息给ulee@land 加好友    发送短消息息给ulee@land 发消息
发表于: IP:您无权察看 2012-12-20 10:28:08 | [全部帖] [楼主帖] 楼主

北京联动北方科技有限公司Try 11g OLTP compress 北京联动北方科技有限公司

.

分类: Oracle

Oracle11g增加了很多压缩的功能,如对OLTP操作下表压缩的完善,Data Pump 文件的压缩,standby日志传输的压缩,RMAN备份的压缩。

10g之前指定表的compress选项,只能在direct path load或者table move的时候进行压缩

11g中指定compress for all operations则增加了对表压缩的条件。如orawh所总结,

oracle改变了压缩的行为,不是每次发生数据变化都会去压缩,而是通过内部的threshold来控制压缩,并且压缩是由transaction触发的,当一个transaction触发DML操作,oracle会去根据threshold来判断是否需要对整个BLOCK进行compress,如果compress后又到达threshold,那么oracle会再去recompress整个BLOCK,直到oracle觉得没有可压缩的余地,而且只有触发compresstransaction会有一些压缩的代价。

测试如下,

[coolcode lang=”sql” rownum=”no”]
SQL> create table test_compress (id number, name varchar2(3000)) compress for all operations;
Table created.
SQL> begin
2  for i in 1..10000 loop
3  insert into test_compress values(i,lpad(’test’,3000,’x') );
4  commit;
5  end loop;
6  end;
7  /
PL/SQL procedure successfully completed.
SQL>analyze table test_compress estimate statistics;
Table analyzed.
SQL> select  table_name,blocks from dba_tables where table_name=’TEST_COMPRESS’;
TABLE_NAME     BLOCKS
———- ———-
TEST_COMPRESS        118
SQL> drop table test_compress;
Table dropped.
SQL> create table test_compress (id number, name varchar2(3000)) compress for all operations;
Table created.
SQL> begin
2  for i in 1..10000 loop
3  insert into test_compress values(i,lpad(’test’,3000,’x') );
4  end loop;
5  end;
6  /
PL/SQL procedure successfully completed.
SQL>commit;
Commit complete
SQL>analyze table test_compress estimate statistics;
Table analyzed.
SQL> select table_name,blocks from dba_tables where table_name=’TEST_COMPRESS’;
TABLE_NAME     BLOCKS
———- ———-
TEST_COMPRESS       5032
SQL> alter table test_compress move;
Table altered.
SQL> analyze table test_compress estimate statistics;
Table analyzed.
SQL>select  table_name,blocks from dba_tables where table_name=’TEST_COMPRESS’
TABLE_NAME     BLOCKS
———- ———-
TEST_COMPRESS         59
[/coolcode]


如上测试,由transaction来触发压缩,并且只针对DML操作touchblock进行压缩。

且频繁的更新操作会导致表上有较多的Chained Rows

[coolcode lang=”sql” rownum=”no”]
SQL>  create index idx2 on test_compress(id);
Index created.
SQL> begin
2  for i in 1..1000 loop
3  update test_compress set id=id+i+40000 where id=i;
4  commit;
5  end loop;
6  end;
7  /
PL/SQL procedure successfully completed.
SQL> analyze table test_compress estimate statistics;
Table analyzed.
SQL> select  table_name,blocks from dba_tables where table_name=’TEST_COMPRESS’;
TABLE_NAME     BLOCKS
———- ———-
TEST_COMPRESS         59
SQL> begin
2  for i in 1..10000 loop
3  if mod(i,5) = 0 then
4  update test_compress set id=id+i+40000,name=lpad(’update’,3000,’x') where id=i;
5  end if;
6  commit;
7  end loop;
8  end;
9  /
PL/SQL procedure successfully completed.
SQL> analyze table test_compress estimate statistics;
Table analyzed.
SQL> select  table_name,blocks,CHAIN_CNT  from dba_tables where table_name=’TEST_COMPRESS’;
TABLE_NAME     BLOCKS     CHAIN_CNT
———- ————– ———-
TEST_COMPRESS       1888      20673
SQL> select count(*) from TEST_COMPRESS;
COUNT(*)
———-
20000
SQL> alter table TEST_COMPRESS move;
Table altered.
SQL> alter index BINZHANG.IDX2 rebuild;
Index altered.
SQL> analyze table test_compress estimate statistics;
Table analyzed.
SQL> select  table_name,blocks,CHAIN_CNT  from dba_tables where table_name=’TEST_COMPRESS’;
TABLE_NAME     BLOCKS  CHAIN_CNT
———- ———- ———-
TEST_COMPRESS         62          0
[/coolcode]


该功能的增强使得在CPU不是系统瓶颈的服务器上压缩不常用的相对不重要但要保留的历史纪录的时候多了一些灵活性。




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论