Updated on 2025-05-29 GMT+08:00

DBE_COMPRESSION

API Description

Evaluates the sampling compression rate of a specified data object or obtains the compression type of a specified row of data based on the input parameters.

Table 1 DBE_COMPRESSION

API

Description

GET_COMPRESSION_RATIO

Evaluates the sampling compression rate of a specified data object based on input parameters.

GET_COMPRESSION_TYPE

Obtains the compression type of data in a specified row based on input parameters.

The GET_COMPRESSION_TYPE API supports only DNs in the distributed database.

  • DBE_COMPRESSION.GET_COMPRESSION_RATIO

    Evaluates the sampling compression rate of a specified data object based on input parameters. The prototype is as follows:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    DBE_COMPRESSION.GET_COMPRESSION_RATIO(
    SCRATCHTBSNAME IN VARCHAR2,
    OWNNAME        IN VARCHAR2,
    OBJNAME        IN VARCHAR2,
    SUBOBJNAME     IN VARCHAR2,
    COMPTYPE       IN NUMBER,
    BLKCNT_CMP     OUT INTEGER,
    BLKCNT_UNCMP   OUT INTEGER,
    ROW_CMP        OUT INTEGER,
    ROW_UNCMP      OUT INTEGER,
    CMP_RATIO      OUT NUMBER,
    COMPTYPE_STR   OUT VARCHAR2,
    SAMPLE_RATIO   IN NUMBER DEFAULT 20,
    OBJTYPE        IN INTEGER DEFAULT 1);
    
    Table 2 DBE_COMPRESSION.GET_COMPRESSION_RATIO API parameters

    Parameter

    Description

    SCRATCHTBSNAME

    Tablespace to which a data object belongs.

    OWNNAME

    Data object owner (schema to which the data object belongs).

    OBJNAME

    Data object name.

    SUBOBJNAME

    Name of a data subobject.

    COMPTYPE

    Compression type. The options are as follows:
    • 1: uncompressed.
    • 2: advanced compression.

    BLKCNT_CMP

    Number of blocks occupied by compressed samples.

    BLKCNT_UNCMP

    Number of blocks occupied by uncompressed samples.

    ROW_CMP

    Number of rows that can be contained in a single block after samples are compressed.

    ROW_UNCMP

    Number of rows that can be contained in a single block when samples are not compressed.

    CMP_RATIO

    Compression ratio, that is, blkcnt_uncmp divided by blkcnt_cmp.

    COMPTYPE_STR

    Character string that describes the compression type.

    SAMPLE_RATIO

    Sampling ratio. The value is an integer or floating-point number ranging from 0 to 100, corresponding to the sampling ratio of N percent. The default value is 20, indicating that 20% of the rows are sampled.

    OBJTYPE

    Object type. The options are as follows:
    • 1: table object.
  • DBE_COMPRESSION.GET_COMPRESSION_TYPE

    This API is used to obtain the compression type of a specified row based on input parameters. This API is an O&M API and does not check the visibility. That is, if the input CTID is a deleted row, this API still returns the latest status of the current row on the page. The prototype is as follows:

    1
    2
    3
    4
    5
    6
    DBE_COMPRESSION.GET_COMPRESSION_TYPE(
    OWNNAME    IN VARCHAR2,
    TABNAME    IN VARCHAR2,
    CTID       IN TEXT,
    SUBOBJNAME IN VARCHAR2 DEFAULT NULL,
    BUCKETID   IN pg_catalog.int2 DEFAULT NULL)
    
    Table 3 DBE_COMPRESSION.GET_COMPRESSION_TYPE API parameters

    Parameter

    Description

    OWNNAME

    Data object owner (schema to which the data object belongs).

    TABNAME

    Data object name.

    CTID

    CTID of the target row.

    SUBOBJNAME

    Name of a data subobject.

    BUCKETID

    Table bucket ID of the target row, which is used only for bucket tables. The default value is NULL.