oltp compress

验证:Rows inserted without using direct-path insert and updated rows are compressed using OLTP compression.


创建oltp compress 表
       ----- append 方式插入
SQL> create table t compress  for oltp tablespace test  as  select * From emp where 0=1;
表已创建。
           ----普通方式插入数据
      create table t1 compress   for oltp  tablespace test  as  select * From emp where 0=1;
            ----用于插入append 插入
        create table t2  tablespace test as select * From emp where 0=1;     
          -----普通方式插入数据          
         create table t3  tablespace test as select * From emp where 0=1;

插入数据:
SQL> select count(*)from test;
  COUNT(*)
----------
    196608

insert  /*+ append */into  t select * From test;
 insert  into  t1 select * From test;
insert  /*+ append */into  t2 select * From test;
insert  into  t3 select * From test;



对四个表进行分析:
 analyze table t compute statistics;
 analyze table t1 compute statistics;
 analyze table t2 compute statistics;
 analyze table t3 compute statistics;


SQL> select table_name,blocks,compress_for From dba_tables where table_name in ('T','T1','T2','T3');
TABLE_NAME BLOCKS COMPRESS_FOR
------------------------------ ---------- ------------
T2   1193
T    335    OLTP
T3   1252
T1  496    OLTP

结论:oltp compress 压缩方式下,即使是普通的插入方式,压缩效果也比较好

更新:

更新:
SQL> update t set sal=sal+1;
SQL> update t1 set sal=sal+1;
SQL> update t2 set sal=sal+1;
SQL> update t3 set sal=sal+1;
commit;
对四个表进行分析:
 analyze table t compute statistics;
 analyze table t1 compute statistics;
 analyze table t2 compute statistics;
 analyze table t3 compute statistics;


SQL> select table_name,blocks,compress_for From dba_tables where table_name in ('T','T1','T2','T3');
TABLE_NAME BLOCKS COMPRESS_FOR
------------------------------ ---------- ------------
T2      1193
T        762 OLTP
T3      1252
T1       874 OLTP

结论:oltp压缩方式,在更新后,仍然使用更多的空间,但是相对于不压缩效果还是比较好的


SQL> alter table t2 move compress for oltp;
SQL> analyze table t2 compute statistics;
表已分析。
SQL> select table_name,blocks,compress_for From dba_tables where table_name in ('T','T1','T2','T3');
TABLE_NAME BLOCKS COMPRESS_FOR
------------------------------ ---------- ------------
T 762 OLTP
T3 1252
T2 336 OLTP
T1 874 OLTP

t2 表变成压缩表

SQL> alter table t3 move compress ;
表已更改。


SQL> analyze table t3 compute statistics;
表已分析。
SQL> select table_name,blocks,compress_for From dba_tables where table_name in ('T','T1','T2','T3');
TABLE_NAME BLOCKS COMPRESS_FOR
------------------------------ ---------- ------------
T 762 OLTP
T2 336
T1 874 OLTP
T3 302 BASIC
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值