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. 如果一个键值的前缀条目在索引块中不存在,此前缀才会被写入索引块中。一个前缀被写
入后立即就可以被此索引块内的后缀共享,直到所有引用此前缀的后缀都被删除为止
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-982904/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10599713/viewspace-982904/