[ORACLE] Oracle Compression Advisor dbms_compression.get_compression_ratio压缩比例评估
Oracle Compression Advisor (DBMS_COMPRESSION) 已得到增强,可支持In-Memory 压缩。
该顾问程序估算使用MEMCOMPRESS 可实现的压缩率。这种估算基于表数据样本分析,并能很好地估算表填充到IM 列存储后获得的实际结果。
Constants - Compression Types
Constant | Type | Value | Description |
---|---|---|---|
|
|
|
No compression |
|
|
|
Advanced row compression |
|
|
|
High for query warehouse compression (Hybrid Columnar Compression) |
|
|
|
Low for query warehouse compression (Hybrid Columnar Compression) |
|
|
|
High archive compression (Hybrid Columnar Compression) |
|
|
|
Low archive compression (Hybrid Columnar Compression) |
|
|
|
Compressed block |
|
|
|
High compression level for LOB operations |
|
|
|
Medium compression level for LOB operations |
|
|
|
Low compression level for LOB operations |
|
|
|
High compression level for indexes |
|
|
|
Low compression level for indexes |
|
|
|
Minimum required number of LOBs in the object for which LOB compression ratio is to be estimated |
|
|
|
Basic table compression |
|
|
|
Maximum number of LOBs used to compute the LOB compression ratio |
|
|
|
In-Memory with no compression |
|
|
|
In-Memory compression level for DML |
|
|
|
In-Memory compression level optimized for query performance |
|
|
|
In-Memory compression level optimized on query performance as well as space saving |
|
|
|
In-Memory low compression level optimizing for capacity |
|
|
|
In-Memory high compression level optimizing for capacity |
|
|
|
Minimum required number of rows in the object for which HCC ratio is to be estimated |
|
|
|
To indicate the use of all the rows in the object to estimate HCC ratio |
|
|
|
Identifies the object whose compression ratio is estimated as of type table |
|
|
2 |
Identifies the object whose compression ratio is estimated as of type index |
GET_COMPRESSION_RATIO Procedure Parameters
Parameter | Description |
---|---|
|
Temporary scratch tablespace that can be used for analysis |
|
Schema of the table to analyze |
|
Name of the table to analyze |
|
Name of the object |
|
Name of the partition or sub-partition of the object |
|
Compression types for which analysis should be performed When the object is an index, only the following compression types are valid: Note: The following compression types cannot be specified in this parameter for any type of object: |
|
Number of blocks used by compressed sample of the table |
|
Number of blocks used by uncompressed sample of the table |
|
Number of rows in a block in compressed sample of the table |
|
Number of rows in a block in uncompressed sample of the table |
|
Compression ratio, |
|
String describing the compression type |
|
Number of rows sampled to estimate compression ratio. |
|
Type of the object, either |
|
Name of the LOB column |
|
In case of partitioned tables, the related partition name |
|
Number of lobs actually sampled to estimate compression ratio |
|
List of indexes and their estimated compression ratios |
set serveroutput on declare v_blocks_comp pls_integer; v_blocks_uncomp pls_integer; v_rows_comp pls_integer; v_rows_uncomp pls_integer; v_compress_ratio number; v_compress_type varchar2(32767); begin DBMS_COMPRESSION.GET_COMPRESSION_RATIO(scratchtbsname => 'TEST', ownname =>'C##SAPR3', objname =>'TEST', subobjname => null, comptype => 2, blkcnt_cmp => v_blocks_comp, blkcnt_uncmp => v_blocks_uncomp, row_cmp =>v_rows_comp, row_uncmp =>v_rows_uncomp, cmp_ratio =>v_compress_ratio, comptype_str =>v_compress_type, subset_numrows => dbms_compression.comp_ratio_minrows); dbms_output.put_line('output: '); dbms_output.put_line('estimated compression ratio: ' || v_compress_ratio); dbms_output.put_line('blocks used - compressed sample: ' || v_blocks_comp); dbms_output.put_line('blocks used - uncompressed sample: ' || v_blocks_uncomp); dbms_output.put_line('rows in a block - compressed sample: ' || v_rows_comp); dbms_output.put_line('rows in a block - uncompressed sample: ' || v_rows_uncomp); end; /
结果
Message: PL/SQL procedure successfully completed Console Output Begins: output: estimated compression ratio: 2.2 blocks used - compressed sample: 303 blocks used - uncompressed sample: 696 rows in a block - compressed sample: 401 rows in a block - uncompressed sample: 174 Console Output Ends.