DB2 Version 10.1 for Linux, UNIX, and Windows

ADMIN_GET_TAB_COMPRESS_INFO table function - estimate compression savings

The ADMIN_GET_TAB_COMPRESS_INFO table function estimates the compression savings that can be gained for the table, assuming a REORG with RESETDICTIONARY option will be performed.

This table function provides a direct replacement for the 'ESTIMATE' mode provided by the deprecated ADMIN_GET_TAB_COMPRESS_INFO table function in previous versions of DB2® for Linux, UNIX, and Windows.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-ADMIN_GET_TAB_COMPRESS_INFO--(--tabschema--,--tabname--)----><

The schema is SYSPROC.

Table function parameters

tabschema
An input argument of type VARCHAR(128) that specifies the schema name.
tabname
An input argument of type VARCHAR(128) that specifies the table name, a materialized query table name or a hierarchy table name.

Authorization

One of the following authorities is required to execute the routine:
  • EXECUTE privilege on the routine
  • DATAACCESS authority
  • DBADM authority
  • SQLADM authority

Default PUBLIC privilege

None

Information returned

Table 1. Information returned for ADMIN_GET_TAB_COMPRESS_INFO
Column Name Data Type Description
TABSCHEMA VARCHAR(128) table_schema - Table schema name monitor element
TABNAME VARCHAR(128) table_name - Table name monitor element
DBPARTITIONNUM SMALLINT dbpartitionnum - Database partition number monitor element
DATAPARTITIONID INTEGER Data partition number.
OBJECT_TYPE VARCHAR(4) objtype - Object type monitor element
ROWCOMPMODE CHAR(1) The current row compression mode for the object. The returned metric can be one of the following values:
  • 'S' if Classic Row Compression is enabled
  • 'A' if Adaptive Row Compression is enabled
  • Blank if no row compression is enabled
PCTPAGESSAVED_CURRENT SMALLINT Current percentage of pages saved from row compression.
AVGROWSIZE_CURRENT SMALLINT Current average record length.
PCTPAGESSAVED_STATIC SMALLINT Estimated percentage of pages saved from Classic Row Compression.
AVGROWSIZE_STATIC SMALLINT Estimated average record length from Classic Row Compression.
PCTPAGESSAVED_ADAPTIVE SMALLINT Estimated percentage of pages saved from Adaptive Row Compression.
AVGROWSIZE_ADAPTIVE SMALLINT Estimated average record length from Adaptive Row Compression.

Usage Notes

Examples

Example 1: View the current compression results and estimate report of both classic row compression and adaptive compression information of the TABLE1 table in the SCHEMA1 schema.
SELECT SUBSTR(TABSCHEMA, 1, 10) AS TABSCHEMA, SUBSTR(TABNAME, 1, 10) AS TABNAME, 
       DBPARTITIONNUM, DATAPARTITIONID, OBJECT_TYPE, ROWCOMPMODE, 
       PCTPAGESSAVED_CURRENT, AVGROWSIZE_CURRENT, 
       PCTPAGESSAVED_STATIC, AVGROWSIZE_STATIC, 
       PCTPAGESSAVED_ADAPTIVE, AVGROWSIZE_ADAPTIVE 
FROM TABLE(SYSPROC.ADMIN_GET_TAB_COMPRESS_INFO('SCHEMA1', 'TABLE1'))
Output from this query:
TABSCHEMA  TABNAME    DBPARTITIONNUM DATAPARTITIONID OBJECT_TYPE ROWCOMPMODE ...
---------- ---------- -------------- --------------- ----------- ----------- ...
SCHEMA1    TABLE1                  0               0 DATA        A           ...
SCHEMA1    TABLE1                  0               0 XML         S           ...

PCTPAGESSAVED_CURRENT AVGROWSIZE_CURRENT PCTPAGESSAVED_STATIC AVGROWSIZE_STATIC ...
--------------------- ------------------ -------------------- ----------------- ...
                   60                 40                   68                34 ...
                   58                255                   62               198 ...

PCTPAGESSAVED_ADAPTIVE AVGROWSIZE_ADAPTIVE 
---------------------- ------------------- 
                    70                  30 
                    62                 198 

  2 record(s) selected.