Oracle Index Key Compression索引壓縮
Index Key Compression
Oracle Database can use to compress portions of the primary key column values in a B-tree index or an index-organized table. Key compression can greatly reduce the space consumed by the index.
In general, index keys have two pieces, a grouping piece and a unique piece. Key compression breaks the index key into a prefix entry, which is the grouping piece, and a suffix entry, which is the unique or nearly unique piece. The database achieves compression by sharing the prefix entries among the suffix entries in an index block.
Note:
If a key is not defined to have a unique piece, then the database provides one by appending a rowid to the grouping piece.
By default, the prefix of a unique index consists of all key columns excluding the last one, whereas the prefix of a nonunique index consists of all key columns. For example, suppose that you create a composite index on the oe.orders table as follows:
CREATE INDEX orders_mod_stat_ix ON orders ( order_mode, order_status );
Many repeated values occur in the order_mode and order_status columns. An index block may have entries as shown in .
Example 3-3 Index Entries in Orders Table
online,0,AAAPvCAAFAAAAFaAAa
online,0,AAAPvCAAFAAAAFaAAg
online,0,AAAPvCAAFAAAAFaAAl
online,2,AAAPvCAAFAAAAFaAAm
online,3,AAAPvCAAFAAAAFaAAq
online,3,AAAPvCAAFAAAAFaAAt
In , the key prefix would consist of a concatenation of the order_mode and order_status values. If this index were created with default key compression, then duplicate key prefixes such as online,0 and online,2 would be compressed. Conceptually, the database achieves compression as shown in the following example:
online,0
AAAPvCAAFAAAAFaAAa
AAAPvCAAFAAAAFaAAg
AAAPvCAAFAAAAFaAAl
online,2
AAAPvCAAFAAAAFaAAm
online,3
AAAPvCAAFAAAAFaAAq
AAAPvCAAFAAAAFaAAt
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.
Alternatively, you could specify a prefix length when creating a compressed index. For example, if you specified prefix length 1, then the prefix would be order_mode and the suffix would be order_status,rowid. For the values in , the index would factor out duplicate occurrences of online as follows:
online
0,AAAPvCAAFAAAAFaAAa
0,AAAPvCAAFAAAAFaAAg
0,AAAPvCAAFAAAAFaAAl
2,AAAPvCAAFAAAAFaAAm
3,AAAPvCAAFAAAAFaAAq
3,AAAPvCAAFAAAAFaAAt
The index stores a specific prefix once per leaf block at most. 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.
See Also:
· to learn how to use compressed indexes
· to learn how to use key compression for partitioned indexes
· for descriptions of the key_compression clause of CREATE INDEX
key_compression Specify COMPRESS to enable key compression, which eliminates repeated occurrence of key column values and may substantially reduce storage. Use integer to specify the prefix length (number of prefix columns to compress).
Oracle Database compresses indexes that are nonunique or unique indexes of at least two columns. If you want to use compression for a partitioned index, then you must create the index with compression enabled at the index level. You can subsequently enable and disable the compression setting for individual partitions of such a partitioned index. You can also enable and disable compression when rebuilding individual partitions. You can modify an existing non-partitioned index to enable or disable compression only when rebuilding the index.
· For unique indexes, the valid range of prefix length values is from 1 to the number of key columns minus 1. The default prefix length is the number of key columns minus 1.
· For nonunique indexes, the valid range of prefix length values is from 1 to the number of key columns. The default prefix length is the number of key columns.
Restriction on Key Compression You cannot specify COMPRESS for a bitmap index.
NOCOMPRESS Specify NOCOMPRESS to disable key compression. This is the default.
Compressing an Index: Example To create the ord_customer_ix_demo index with the COMPRESS clause, you might issue the following statement:
CREATE INDEX ord_customer_ix_demo
ON orders (customer_id, sales_rep_id)
COMPRESS 1;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25583515/viewspace-2146379/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 索引壓縮Oracle索引
- Oracle Hybrid Columnar Compression(HCC) 混合列壓縮Oracle
- Oracle 表壓縮(Table Compression)技術介紹Oracle
- Oracle10g備份集壓縮新特性(Backupset Compression)Oracle
- Nginx R31 doc-11-Compression and Decompression 壓縮與解壓縮Nginx
- 【實驗】【索引壓縮】索引壓縮演示及優缺點總結索引
- Sqlserver表和索引壓縮SQLServer索引
- oracle index索引原理OracleIndex索引
- 並查集系列之「路徑壓縮( path compression ) 」並查集路徑壓縮
- Advanced Index CompressionIndex
- ORACLE 壓縮Oracle
- Oracle 12c新特性之:使用高階索引壓縮建立索引Oracle索引
- Oracle表壓縮Oracle
- oracle 表壓縮Oracle
- Index key值(索引列上的值)以及rowidIndex索引
- Oracle索引分裂(Index Block Split)Oracle索引IndexBloC
- Oracle筆記 之 索引(index)Oracle筆記索引Index
- oracle index索引結構(一)OracleIndex索引
- oracle dml與索引index(一)Oracle索引Index
- Oracle壓縮黑科技(一)—基礎表壓縮Oracle
- 壓縮table and index 對 space 的影響testIndex
- oracle壓縮表(一)Oracle
- oracle壓縮表(二)Oracle
- oracle 的表壓縮Oracle
- Oracle表的壓縮Oracle
- oracle壓縮技術Oracle
- Oracle資料壓縮Oracle
- Oracle壓縮黑科技(二)—壓縮資料的修改Oracle
- SQL Server 2008 表和索引的行壓縮和頁壓縮SQLServer索引
- oracle 點陣圖索引(bitmap index)Oracle索引Index
- oracle index索引相關筆記OracleIndex索引筆記
- Oracle——EXPDP加密和壓縮Oracle加密
- oracle壓縮表表空間Oracle
- oracle全文索引之STOPLIST_ CTXCAT 索引_INDEX SETOracle索引Index
- Oracle Database Compression 1 - Basic CompressionOracleDatabase
- index索引Index索引
- 【INDEX】Oracle 索引常見知識梳理IndexOracle索引
- Nginx網路壓縮 CSS壓縮 圖片壓縮 JSON壓縮NginxCSSJSON