签到成功

知道了

CNDBA社区CNDBA社区

Orcle 12c 新特性---Advanced Index Compression

2017-08-06 09:45 1662 0 原创 Oracle 12C
作者: Expect-乐

说明

Advanced Index Compression works well on all supported indexes, including those indexes that are not good candidates for the existing prefix compression feature; including indexes with no, or few, duplicate values in the leading columns of the index.

高级索引压缩在所有受支持的索引上使用都非常好,包括那些不适合现有前缀压缩特性的索引;

在索引的前导列中包含没有或很少重复值的索引。

Advanced Index Compression improves the compression ratios significantly while still providing efficient access to the index.

高级索引压缩大大提高了压缩率,同时仍然访问索引很有效率。

实验

在启用高级索引压缩之前,数据库必须是12.1.0以及以上版本。压缩级别:LOW,HIGHhttp://www.cndba.cn/Expect-le/article/2057

2.1   创建表并插入数据

SQL> conn lei/lei@lei1;

Connected.

SQL> create table cndba_t as select * from dba_objects;

Table created.

 
SQL> insert into cndba_t select * from cndba_t;

81053 rows created.

 
SQL> /

162106 rows created.

2.2   创建普通索引

SQL> create index cndba_ind on cndba_t(object_name);

Index created.

http://www.cndba.cn/Expect-le/article/2057

--查看索引大小http://www.cndba.cn/Expect-le/article/2057

SQL> select segment_name ,sum(bytes)/1024/1024

from user_segments

where segment_type ='INDEX'

and SEGMENT_NAME ='CNDBA_IND'

group by segment_name;  2    3    4    5  


SEGMENT_NAME	   SUM(BYTES)/1024/1024
------------------ --------------------
CNDBA_IND	     17  --大小为17M

2.2.1  重建已有索引为高级压缩索引

现在将cndba_ind索引重建为高级压缩索引http://www.cndba.cn/Expect-le/article/2057

SQL> ALTER INDEX CNDBA_IND REBUILD COMPRESS ADVANCED LOW;

Index altered.

--再次查看索引大小

SQL> select segment_name ,sum(bytes)/1024/1024

from user_segments

where segment_type ='INDEX'

and SEGMENT_NAME ='CNDBA_IND'

group by segment_name;  2    3    4    5  

 
SEGMENT_NAME	   SUM(BYTES)/1024/1024
------------------ --------------------
CNDBA_IND	      8  --大小为8M,可以看到几乎减少了一半的大小。


http://www.cndba.cn/Expect-le/article/2057

2.3   创建高级压缩索引

http://www.cndba.cn/Expect-le/article/2057

SQL> CREATE INDEX CNDBA_IND ON CNDBA_T(object_name) COMPRESS ADVANCED LOW;

Index created.

http://www.cndba.cn/Expect-le/article/2057
http://www.cndba.cn/Expect-le/article/2057http://www.cndba.cn/Expect-le/article/2057

--查看索引大小http://www.cndba.cn/Expect-le/article/2057

SQL> select segment_name ,sum(bytes)/1024/1024

from user_segments

where segment_type ='INDEX'

and SEGMENT_NAME ='CNDBA_IND'

group by segment_name;  2    3    4    5  


SEGMENT_NAME	   SUM(BYTES)/1024/1024
------------------ --------------------
CNDBA_IND	      8   -大小不变

版权声明:本文为博主原创文章,未经博主允许不得转载。

高级索引压缩

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
Expect-乐

Expect-乐

关注

Without the continuous bitter cold, there can be no fragrant plum blossom

  • 336
    原创
  • 6
    翻译
  • 100
    转载
  • 41
    评论
  • 访问:1570501次
  • 积分:1957
  • 等级:核心会员
  • 排名:第4名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ