The MON_GET_SECTION table function returns a copy of a section for a dynamic or static SQL statement from the package cache. The section that is returned can be saved for future analysis. For example, when you investigate a plan change for a statement, the saved section can be passed as input to the EXPLAIN_FROM_DATA stored procedure to examine the previous access plan.
None
The routine searches the package cache on all members for the section. For static SQL, the catalogs are searched if the section is no longer in the package cache.
If a null or invalid value is specified, SQL0171 is returned.
Column name | Data type | Description |
---|---|---|
SECTION_TYPE | CHAR(1) | section_type - Section type indicator monitor element |
SECTION_ENV | BLOB(134 MB) | section_env - Section environment monitor element |
INSERT INTO
REPOSITORY_SECTIONS(STMT_TEXT, STMTID, PLANID,
SEMANTIC_ENV_ID, SECTION_DATA)
SELECT STMT_TEXT, STMTID, PLANID, SEMANTIC_ENV_ID,
( SELECT B.SECTION_ENV
FROM TABLE(MON_GET_SECTION(A.EXECUTABLE_ID)) AS B)
SECTION_DATA
FROM TABLE(MON_GET_PKG_CACHE_STMT(NULL,NULL,NULL,-2)) AS A
You can use this information to build a history of statements that
ran. You can use the EXPLAIN_FROM_DATA stored procedure to examine
the access plan for each saved statement by passing the saved section
to the stored procedure.