Prefix and Suffix Entries (216)

Key compression breaks the index key into a prefix entry (the grouping piece) and a
suffix entry (the unique piece). Compression is achieved by sharing the prefix entries
among the suffix entries in an index block. Only keys in the leaf blocks of a B-tree
index are compressed. In the branch blocks the key suffix can be truncated, but the key
is not compressed.

Key compression is done within an index block but not across multiple index blocks.
Suffix entries form the compressed version of index rows. Each suffix entry references
a prefix entry, which is stored in the same index block as the suffix entry.

By default, the prefix consists of all key columns excluding the last one.
Alternatively, you can specify the prefix length, which is the number of columns in the
prefix.

The maximum prefix length for a nonunique index is the number of key columns, and
the maximum prefix length for a unique index is the number of key columns minus
one.

Prefix entries are written to the index block only if the index block does not already
contain a prefix entry whose value is equal to the present prefix entry. Prefix entries
are available for sharing immediately after being written to the index block and
remain available until the last deleted referencing suffix entry is cleaned out of the
index block.

前缀条目和后缀条目
1. 键压缩将索引键分为前缀条目(分组片段)和后缀条目(唯一片段)
2. 在平衡树索引中只有位于叶子块的键会被压缩。在分支块中键的后缀可以truncae , 但不会键压缩
3. 键压缩只能在每个索引块内实现 。 压缩后每个索引行只保存后缀,而每个后缀将引用一个共享的前缀
4. 默认情况下,前缀由除去最后一列之外的其他键列构成。也可以手工设定前缀长度
5. 非唯一索引的最大前缀长度为键列的个数,而唯一索引的最大前缀长度为键列的个数减 1
6. 如果一个键值的前缀条目在索引块中不存在,此前缀才会被写入索引块中。一个前缀被写
入后立即就可以被此索引块内的后缀共享,直到所有引用此前缀的后缀都被删除为止

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-982904/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10599713/viewspace-982904/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值