Oracle® Database PL/SQL Packages and Types Reference 11g Release 2 (11.2) Part Number E10577-04 |
|
|
View PDF |
The DBMS_COMPRESSION
package provides an interface to facilitate choosing the correct compression level for an application.
See Also:
This chapter contains the following topics:
Overview
Security Model
Constants
Views
The DBMS_COMPRESSION
package gathers compression-related information within a database environment. This includes tools for estimating compressibility of a table for both partitioned and non-partitioned tables, and gathering row-level compression information on previously compressed tables. This gives the user with adequate information to make compression-related decision.
The DBMS_COMPRESSSION
package is owned by user SYS
, and must be created by SYS
. The execution privilege is granted to PUBLIC
. Subprograms in this package are executed using the privileges of the current user.
The DBMS_COMPRESSION
package uses the constants shown in Table 34-1, "DBMS_COMPRESSION Constants - Compression Types"e:
Table 34-1 DBMS_COMPRESSION Constants - Compression Types
Constant | Type | Value | Description |
---|---|---|---|
|
|
|
No compression |
|
|
|
OLTP compression |
|
|
|
High compression level for query operations |
|
|
|
Low compression level for query operations |
|
|
|
High compression level for archive operations |
|
|
|
Low compression level for archive operations |
The DBMS_DST
package uses views described in the Oracle Database Reference. The twenty catalog views that contain a COMPRESS_FOR
or DEF_COMPRESS_FOR
will have a list of valid displayed values to be one of the following:
BASIC
OLTP
QUERY
LOW
QUERY
HIGH
ARCHIVE
LOW
ARCHIVE
LOW
The affected views are:
Table 34-2 DBMS_COMPRESSION Package Subprograms
Subprogram | Description |
---|---|
Analyzes the compression ratio of a table, and gives information about compressibility of a table |
|
Returns the compression type for a specified row |
This procedure analyzes the compression ratio of a table, and gives information about compressibility of a table. Various parameters can be provided by the user to selectively analyze different compression types.
Syntax
DBMS_COMPRESSION.GET_COMPRESSION_RATIO ( scratchtbsname IN VARCHAR2, ownname IN VARCHAR2, tabname IN VARCHAR2, partname IN VARCHAR2, comptype IN NUMBER, blkcnt_cmp OUT PLS_INTEGER, blkcnt_uncmp OUT PLS_INTEGER, row_perblk_cmp OUT PLS_INTEGER, row_perblk_uncmp OUT PLS_INTEGER, cmp_ratio OUT NUMBER, comptype_str OUT varchar2);
Parameters
Table 34-3 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 |
|
In case of partitioned tables, the related partition name |
|
Compression types for which analysis should be performed |
|
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 |
Usage Notes
The procedure creates different tables in the scratch tablespace and runs analysis on these objects. It does not modify anything in the user-specified tables.
This function returns the compression type for a specified row. If the row is chained, the function returns the compression type of the head piece only, and does not examine the intermediate or the tail piece since head pieces can be differently compressed.
Syntax
DBMS_COMPRESSION.GET_COMPRESSION_TYPE ( ownname IN VARCHAR2, tabname IN VARCHAR2, row_id IN ROWID) RETURN NUMBER;
Parameters
Table 34-4 GET_COMPRESSION_TYPE Function Parameters
Parameter | Description |
---|---|
|
Schema name of the table |
|
Name of table |
|
Rowid of the row |
Return Values
Flag to indicate the compression type (see DBMS_COMPRESSION Constants - Compression Types).