DB2 10.5 for Linux, UNIX, and Windows

MON_GET_PKG_CACHE_STMT_DETAILS table function - Get package cache statement metrics as an XML document

The MON_GET_PKG_CACHE_STMT_DETAILS table function returns metrics for one or more package cache entries.

The metrics returned by the MON_GET_PKG_CACHE_STMT_DETAILS table function represent the accumulation of all metrics for statements in the package cache. Statement metrics are rolled up to the package cache upon activity completion.

The metrics are returned in an XML document.

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

Syntax

Read syntax diagramSkip visual syntax diagram
>>-MON_GET_PKG_CACHE_STMT_DETAILS--(--section_type--,----------->

>--executable_id--,--search_args--,--member--)-----------------><

The schema is SYSPROC.

Routine parameters

section_type
An optional input argument (either "D" or "S") of type CHAR(1) that specifies information type for the returned statement. If the argument is NULL or an empty string, information is returned for all SQL statements. Not case sensitive: D stands for dynamic; S for static.
executable_id
An optional input argument of type VARCHAR (32) for bit data that specifies a unique section of the database package cache. If a null value is specified, information is returned for all SQL statements. When the executable_id is specified, the section_type argument is ignored. For example, if an executable_id is specified for a dynamic statement, the dynamic statement details will be returned by this table function even if section_type is specified as static ("S").
search_args
An optional input parameter of type CLOB(1K), that allows you to specify one or more optional search argument strings. For example:
'<modified_within>5</modified_within><update_boundary_time>myPkgEvmon
     </update_boundary_time>'
The available search argument tags are as follows:
  • '<modified_within>X</modified_within>'

    Returns only those statement entries that have either been inserted into the cache or executed within the last X minutes (where X is a positive integer value). If the argument is not specified, all entries in the cache are returned.

  • '<update_boundary_time>evmon_name</update_boundary_time>'

    Updates the event monitor boundary timestamp to the current time for the package cache event monitor specified by evmon_name. If this event monitor specifies where updated_since_boundary_time as an output criteria in its WHERE clause, only package cache entries that subsequently have their metrics updated are captured when evicted from the package cache. This operation only has an effect if the specified package cache event monitor is active when the command is issued.

  • '<stmt_details>true</stmt_details>' or '<stmt_details>false</stmt_details>'

    Includes or excludes the stmt_text and comp_env_desc data in the resulting XML document. This allows you to exclude these relatively large portions of the document when you do not need them (for example, if you are using the XML document to provide input for the MON_FORMAT_XML_* table functions that return formatted row-based output). If this argument tag is not specified, the stmt_text and comp_env_desc data are included by default.

Each input argument can be specified only once. The search argument tags must be specified in lowercase.

member
An optional input argument of type INTEGER that specifies a valid member in the same instance as the currently connected database when calling this function. Specify -1 for the current database member, or -2 for all active database members. If the null value is specified, -1 is set.

Information returned

Table 1. Information returned for MON_GET_PKG_CACHE_STMT_DETAILS
Column Name Data Type Description or corresponding monitor element
MEMBER SMALLINT member- Database member
SECTION_TYPE CHAR(1) section_type - Section type indicator.
EXECUTABLE_ID VARCHAR(32) FOR BIT DATA executable_id - Executable ID.
DETAILS BLOB(20M) XML document containing detailed metrics for the unit of work. See Table 2 for a description of the elements in this document.
Table 2. Detailed metrics returned for MON_GET_PKG_CACHE_STMT_DETAILS
Element Name Data Type Description
active_col_vector_consumers_top xs:long active_col_vector_consumers_top - Active columnar_vector consumers high watermark
active_hash_grpbys_top xs:long active_hash_grpbys_top - Active hash Group By operations high watermark
active_hash_joins_top xs:long active_hash_joins_top - Active hash joins operations high watermark
active_olap_funcs_top xs:long active_olap_funcs_top - Active OLAP functions operations high watermark
active_peas_top xs:long active_peas_top - Active partial early aggregations operations high watermark
active_peds_top xs:long active_peds_top - Active partial early distinct operations high watermark
active_sort_consumers_top xs:long active_sort_consumers_top - Active sort consumers high watermark
active_sorts_top xs:long active_sorts_top - Active Sorts high watermark
audit_events_total xs:long audit_events_total - Total audit events
audit_file_write_wait_time xs:long audit_file_write_wait_time - Audit file write wait time
audit_file_writes_total xs:long audit_file_writes_total - Total Audit files written
audit_subsystem_wait_time xs:long audit_subsystem_wait_time - Audit subsystem wait time
audit_subsystem_waits_total xs:long audit_subsystem_waits_total - Total audit subsystem waits
cf_wait_time xs:long cf_wait_time - cluster caching facility wait time monitor element
cf_waits xs:long cf_waits - Number of cluster caching facility waits monitor element
comm_exit_wait_time xs:long comm_exit_wait_time - Communication exit wait time monitor element
comm_exit_waits xs:long comm_exit_waits - Communication exit number of waits monitor element
comp_env_desc xs:hexBinary(10240) comp_env_desc - Compilation environment handle. You can use the existing COMPILATION_ENV table function to get the detailed compilation environment of the specific statement if needed.
coord_stmt_exec_time xs:long coord_stmt_exec_time - Execution time for statement by coordinator agent
deadlocks xs:long deadlocks - Deadlocks detected
diaglog_write_wait_time xs:long diaglog_write_wait_time - Diag log write time
diaglog_writes_total xs:long diaglog_writes_total - Diag log total writes
direct_read_reqs xs:long direct_read_reqs - Direct read requests
direct_read_time xs:long direct_read_time - Direct read time
direct_reads xs:long direct_reads - Direct reads from database
direct_write_reqs xs:long direct_write_reqs - Direct write requests
direct_write_time xs:long direct_write_time - Direct write time
direct_writes xs:long direct_writes - Direct writes to database
disabled_peds xs:long disabled_peds - Disabled partial early distincts
effective_isolation xs:string(2) effective_isolation - Effective isolation. This is the isolation value in effect for the section; it can be different from what it was originally requested at compilation time.
evmon_wait_time xs:nonNegativeInteger evmon_wait_time - Event monitor wait time
evmon_waits_total xs:nonNegativeInteger evmon_waits_total - Event monitor total waits
executable_id xs:hexBinary(32) executable_id - Executable ID.
fcm_message_recv_volume xs:long fcm_message_recv_volume - FCM message recv volume
fcm_message_recv_wait_time xs:long fcm_message_recv_wait_time - FCM message recv wait time
fcm_message_recv_waits_total xs:nonNegativeInteger fcm_message_recv_waits_total - Number of times spent waiting for FCM reply message monitor element
fcm_message_recvs_total xs:long fcm_message_recvs_total - FCM message recvs total
fcm_message_send_volume xs:long fcm_message_send_volume - FCM message send volume
fcm_message_send_wait_time xs:long fcm_message_send_wait_time - FCM message send wait time
fcm_message_send_waits_total xs:nonNegativeInteger fcm_message_send_waits_total - Number of times spent blocking on an FCM message send monitor element
fcm_message_sends_total xs:long fcm_message_sends_total - FCM message sends total
fcm_recv_volume xs:long fcm_recv_volume - FCM recv volume
fcm_recv_wait_time xs:long fcm_recv_wait_time - FCM recv wait time
fcm_recv_waits_total xs:nonNegativeInteger fcm_recv_waits_total - Number of times spent waiting to receive data through FCM monitor element
fcm_recvs_total xs:long fcm_recvs_total - FCM recvs total
fcm_send_volume xs:long fcm_send_volume - FCM send volume
fcm_send_wait_time xs:long fcm_send_wait_time - FCM send wait time
fcm_send_waits_total xs:nonNegativeInteger fcm_send_waits_total - Number of times spent blocking on an FCM send operation monitor element
fcm_sends_total xs:long fcm_sends_total - FCM sends total
fcm_tq_recv_volume xs:long fcm_tq_recv_volume - FCM tablequeue recv volume
fcm_tq_recv_wait_time xs:long fcm_tq_recv_wait_time - FCM tablequeue recv wait time
fcm_tq_recv_waits_total xs:nonNegativeInteger fcm_tq_recv_waits_total - Number of times spent waiting to receive the next buffer monitor element
fcm_tq_recvs_total xs:long fcm_tq_recvs_total - FCM tablequeue recvs total
fcm_tq_send_volume xs:long fcm_tq_send_volume - FCM tablequeue send volume
fcm_tq_send_wait_time xs:long fcm_tq_send_wait_time - FCM tablequeue send wait time
fcm_tq_send_waits_total xs:nonNegativeInteger fcm_tq_send_waits_total - Number of times spent waiting to send the next buffer monitor element
fcm_tq_sends_total xs:long fcm_tq_sends_total - FCM tablequeue send total
hash_grpby_overflows xs:long hash_grpby_overflows - Hash group by overflows
hash_join_overflows xs:long hash_join_overflows - Hash Join Overflows monitor element
hash_join_small_overflows xs:long hash_join_small_overflows - Hash Join Small Overflows monitor element
ida_recv_volume xs:nonNegativeInteger ida_recv_volume - Total data volume received monitor element

The total volume of data the database server received from an in-database analytics process. The value is reported in bytes.

ida_recv_wait_time xs:nonNegativeInteger ida_recv_wait_time - Time spent waiting to receive data monitor element

The total amount of time spent waiting to receive data from an in-database analytics process.

ida_recvs_total xs:nonNegativeInteger ida_recvs_total - Number of times data received monitor element

The total number of times data was received from an in-database analytics process.

ida_send_volume xs:nonNegativeInteger ida_send_volume - Total data volume sent monitor element

The total volume of data sent from the database server to an in-database analytics process. The value is reported in bytes.

ida_send_wait_time xs:nonNegativeInteger ida_send_wait_time - Time spent waiting to send data monitor element

The total amount of time spent waiting to send data to an in-database analytics process.

ida_sends_total xs:nonNegativeInteger ida_sends_total - Number of times data sent monitor element

The total number of times data was sent to an in-database analytics process.

insert_timestamp xs:dateTime insert_timestamp - Statement insert timestamp
int_rows_deleted xs:long int_rows_deleted - Internal Rows Deleted monitor element
int_rows_inserted xs:long int_rows_inserted - Internal Rows Inserted monitor element
int_rows_updated xs:long int_rows_updated - Internal Rows Updated monitor element
last_metrics_update xs:dateTime last_metrics_update - Metrics last update timestamp
lock_escals xs:long lock_escals - Number of lock escalations
lock_escals_global xs:long lock_escals_global - Number of global lock escalations monitor element
lock_escals_locklist xs:long lock_escals_locklist - Number of locklist lock escalations monitor element
lock_escals_maxlocks xs:long lock_escals_maxlocks - Number of maxlocks lock escalations monitor element
lock_timeouts xs:long lock_timeouts - Number of lock timeouts
lock_timeouts_global xs:long lock_timeouts_global - Lock timeouts global monitor element
lock_wait_time_global xs:long lock_wait_time_global - Lock wait time global monitor element
lock_waits_global xs:long lock_waits_global - Lock waits global monitor element
lock_wait_time xs:long lock_wait_time - Time waited on locks
lock_waits xs:long lock_waits - Lock waits
log_buffer_wait_time xs:long log_buffer_wait_time - Log buffer wait time
log_disk_wait_time xs:long log_disk_wait_time - Log disk wait time
log_disk_waits_total xs:long log_disk_waits_total - Log disk waits total
max_coord_stmt_exec_time_args logical-grouping max_coord_stmt_exec_time_args - Maximum coordinator statement execution time arguments
max_coord_stmt_exec_timestamp xs:dateTime max_coord_stmt_exec_timestamp - Maximum coordinator statement execution timestamp
max_coord_stmt_exec_time xs:nonNegativeInteger max_coord_stmt_exec_time - Maximum coordinator statement execution time
member xs:short member- Database member
num_coord_exec_with_metrics xs:long num_coord_exec_with_metrics - Number of executions by coordinator agent with metrics
num_coord_exec xs:long num_coord_exec - Number of executions by coordinator agent
num_exec_with_metrics xs:nonNegativeInteger num_exec_with_metrics - Number of executions with metrics collected.
num_executions xs:nonNegativeInteger num_executions - Statement executions
num_log_buffer_full xs:long num_log_buffer_full - Number of full log buffers
num_lw_thresh_exceeded xs:long num_lw_thresh_exceeded - Number of thresholds exceeded
num_routines xs:int num_routines -Number of routines
num_working_copies xs:long Number of working copies.
olap_func_overflows xs:long olap_func_overflows - OLAP Function Overflows monitor element
package_name xs:string(128) package_name - Package name . This output is valid for static SQL statements only. A NULL value is returned if the statement is dynamic.
package_schema xs:string(128) package_schema - Package schema . This output is valid for static SQL statements only. A NULL value is returned if the statement is dynamic.
package_version_id xs:string(64) package_version_id - Package version. This output is valid for static SQL statements only. This element is not produced if the statement is dynamic or if you did not specify the package version for static statement. If you did not specify the package version identifier when the package was created, an empty string is returned for a static statement.
planid xs:long planid - Query plan ID monitor element
pool_col_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_col_gbp_indep_pages_found_in_lbp - Buffer pool column-organized GBP independent pages found in local buffer pool
pool_col_gbp_invalid_pages xs:nonNegativeInteger pool_col_gbp_invalid_pages - Buffer pool column-organized GBP invalid data pages
pool_col_gbp_l_reads xs:nonNegativeInteger pool_col_gbp_l_reads - Buffer pool column-organized GBP logical reads
pool_col_gbp_p_reads xs:nonNegativeInteger pool_col_gbp_p_reads - Buffer pool column-organized GBP physical reads
pool_col_l_reads xs:nonNegativeInteger pool_col_l_reads - Buffer pool column-organized logical reads
pool_col_lbp_pages_found xs:nonNegativeInteger pool_col_lbp_pages_found - Buffer pool column-organized LBP pages found
pool_col_p_reads xs:nonNegativeInteger pool_col_p_reads - Buffer pool column-organized physical reads
pool_col_writes xs:nonNegativeInteger pool_col_writes - Buffer pool column-organized writes
pool_data_gbp_invalid_pages xs:long pool_data_gbp_invalid_pages - Group buffer pool invalid data pages
pool_data_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_data_gbp_indep_pages_found_in_lbp - Group buffer pool independent data pages found in local buffer pool monitor element
pool_data_gbp_l_reads xs:long pool_data_gbp_invalid_pages - Group buffer pool invalid data pages monitor element
pool_data_gbp_l_reads xs:long pool_data_gbp_l_reads - Group buffer pool data logical reads monitor element
pool_data_gbp_p_reads xs:long pool_data_gbp_p_reads - Group buffer pool data physical reads monitor element
pool_data_l_reads xs:long pool_data_l_reads - Buffer pool data logical reads
pool_data_lbp_pages_found xs:long pool_data_lbp_pages_found - Local buffer pool found data pages monitor element
pool_data_p_reads xs:long pool_data_p_reads - Buffer pool data physical reads
pool_data_writes xs:long pool_data_writes - Buffer pool data writes
pool_failed_async_col_reqs xs:nonNegativeInteger pool_failed_async_col_reqs - Failed column-organized prefetch requests
pool_failed_async_data_reqs xs:nonNegativeInteger pool_failed_async_data_reqs - Failed data prefetch requests monitor element
pool_failed_async_index_reqs xs:nonNegativeInteger pool_failed_async_index_reqs - Failed index prefetch requests monitor element
pool_failed_async_other_reqs xs:nonNegativeInteger pool_failed_async_other_reqs - Failed non-prefetch requests monitor element
pool_failed_async_temp_col_reqs xs:nonNegativeInteger pool_failed_async_temp_col_reqs - Failed column-organized temporary prefetch requests
pool_failed_async_temp_data_reqs xs:nonNegativeInteger pool_failed_async_temp_data_reqs - Failed data prefetch requests for temporary table spaces monitor element
pool_failed_async_temp_index_reqs xs:nonNegativeInteger pool_failed_async_temp_index_reqs - Failed index prefetch requests for temporary table spaces monitor element
pool_failed_async_temp_xda_reqs xs:nonNegativeInteger pool_failed_async_temp_xda_reqs - Failed XDA prefetch requests for temporary table spaces monitor element
pool_failed_async_xda_reqs xs:nonNegativeInteger pool_failed_async_xda_reqs - Failed XDA prefetch requests monitor element
pool_index_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_index_gbp_indep_pages_found_in_lbp - Group buffer pool independent index pages found in local buffer pool monitor element
pool_index_gbp_invalid_pages xs:long pool_index_gbp_invalid_pages - Group buffer pool invalid index pages
pool_index_gbp_l_reads xs:long pool_index_gbp_l_reads - Group buffer pool index logical reads
pool_index_gbp_p_reads xs:long pool_index_gbp_p_reads - Group buffer pool index physical reads
pool_index_l_reads xs:long pool_index_l_reads - Buffer pool index logical reads
pool_index_lbp_pages_found xs:long pool_index_lbp_pages_found - Local buffer pool index pages found
pool_index_p_reads xs:long pool_index_p_reads - Buffer pool index physical reads
pool_index_writes xs:long pool_index_writes - Buffer pool index writes
pool_queued_async_col_pages xs:nonNegativeInteger pool_queued_async_col_pages - Column-organized page prefetch requests
pool_queued_async_col_reqs xs:nonNegativeInteger pool_queued_async_col_reqs - Column-organized prefetch requests
pool_queued_async_data_pages xs:nonNegativeInteger pool_queued_async_data_pages - Data pages prefetch requests monitor element
pool_queued_async_data_reqs xs:nonNegativeInteger pool_queued_async_data_reqs - Data prefetch requests monitor element
pool_queued_async_index_pages xs:nonNegativeInteger pool_queued_async_index_pages - Index pages prefetch requests monitor element
pool_queued_async_index_reqs xs:nonNegativeInteger pool_queued_async_index_reqs - Index prefetch requests monitor element
pool_queued_async_other_reqs xs:nonNegativeInteger pool_queued_async_other_reqs - Non-prefetch requests monitor element
pool_queued_async_temp_col_pages xs:nonNegativeInteger pool_queued_async_temp_col_pages - Column-organized page temporary prefetch requests
pool_queued_async_temp_col_reqs xs:nonNegativeInteger pool_queued_async_temp_col_reqs - Column-organized temporary prefetch requests
pool_queued_async_temp_data_pages xs:nonNegativeInteger pool_queued_async_temp_data_pages - Data pages prefetch requests for temporary table spaces monitor element
pool_queued_async_temp_data_reqs xs:nonNegativeInteger pool_queued_async_temp_data_reqs - Data prefetch requests for temporary table spaces monitor element
pool_queued_async_temp_index_pages xs:nonNegativeInteger pool_queued_async_temp_index_pages - Index pages prefetch requests for temporary table spaces monitor element
pool_queued_async_temp_index_reqs xs:nonNegativeInteger pool_queued_async_temp_index_reqs - Index prefetch requests for temporary table spaces monitor element
pool_queued_async_temp_xda_pages xs:nonNegativeInteger pool_queued_async_temp_xda_pages - XDA data pages prefetch requests for temporary table spaces monitor element
pool_queued_async_temp_xda_reqs xs:nonNegativeInteger pool_queued_async_temp_xda_reqs - XDA data prefetch requests for temporary table spaces monitor element
pool_queued_async_xda_pages xs:long pool_queued_async_xda_pages - XDA pages prefetch requests monitor element
pool_queued_async_xda_reqs xs:nonNegativeInteger pool_queued_async_xda_reqs - XDA prefetch requests monitor element
pool_read_time xs:long pool_read_time - Total buffer pool physical read time
pool_temp_col_l_reads xs:nonNegativeInteger pool_temp_col_l_reads - Buffer pool column-organized temporary logical reads
pool_temp_col_p_reads xs:nonNegativeInteger pool_temp_col_p_reads - Buffer pool column-organized temporary physical reads
pool_temp_data_l_reads xs:long pool_temp_data_l_reads - Buffer pool temporary data logical reads
pool_temp_data_p_reads xs:long pool_temp_data_p_reads - Buffer pool temporary data physical reads
pool_temp_index_l_reads xs:long pool_temp_index_l_reads - Buffer pool temporary index logical reads
pool_temp_index_p_reads xs:long pool_temp_index_p_reads - Buffer pool temporary index physical reads
pool_temp_xda_l_reads xs:long pool_temp_xda_l_reads - Buffer pool temporary XDA data logical reads monitor element
pool_temp_xda_p_reads xs:long pool_temp_xda_p_reads - Buffer pool temporary XDA data physical reads
pool_write_time xs:long pool_write_time - Total buffer pool physical write time
pool_xda_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_xda_gbp_indep_pages_found_in_lbp - Group buffer pool XDA independent pages found in local buffer pool monitor element
pool_xda_gbp_invalid_pages xs:nonNegativeInteger pool_xda_gbp_invalid_pages - Group buffer pool invalid XDA data pages
pool_xda_gbp_l_reads xs:nonNegativeInteger pool_xda_gbp_l_reads - Group buffer pool XDA data logical read requests
pool_xda_gbp_p_reads xs:nonNegativeInteger pool_xda_gbp_p_reads - Group buffer pool XDA data physical read requests
pool_xda_l_reads xs:long pool_xda_l_reads - Buffer pool XDA data logical reads monitor element
pool_xda_lbp_pages_found xs:nonNegativeInteger pool_xda_lbp_pages_found - Local buffer pool XDA data pages found
pool_xda_l_reads xs:long pool_xda_l_reads - Buffer pool XDA data logical reads
pool_xda_p_reads xs:long pool_xda_p_reads - Buffer pool XDA data physical reads
pool_xda_writes xs:long pool_xda_writes - Buffer pool XDA data writes
post_shrthreshold_hash_joins xs:long post_shrthreshold_hash_joins - Post threshold hash joins monitor element
post_shrthreshold_sorts xs:long post_shrthreshold_sorts - Post shared threshold sorts
post_threshold_col_vector_consumers xs:long post_threshold_col_vector_consumers - Post threshold columnar_vector consumers
post_threshold_hash_grpbys xs:long post_threshold_hash_grpbys - Hash group by thresholdpost_threshold_hash_grpbys - Hash group by threshold
post_threshold_hash_joins xs:long post_threshold_hash_joins - Hash Join Threshold monitor element
post_threshold_olap_funcs xs:long post_threshold_olap_funcs - OLAP function threshold monitor element
post_threshold_peas xs:long post_threshold_peas - Partial early aggregation threshold
post_threshold_peds xs:long post_threshold_peds - Partial early distincts threshold
post_threshold_sorts xs:long post_threshold_sorts - Post threshold sorts
prefetch_wait_time xs:nonNegativeInteger prefetch_wait_time - Time waited for prefetch
prefetch_waits xs:nonNegativeInteger prefetch_waits - Prefetcher wait count monitor element
prep_time xs:nonNegativeInteger prep_time - Preparation time Note that PREP_TIME is only valid for dynamic SQL statements. PREP_TIME is reported as 0 for static SQL statements.
prep_warning_reason xs:int prep_warning_reason - Prepare warning SQLCODE reason identifier monitor element
prep_warning xs:int prep_warning - Prepare warning SQLCODE monitor element
query_cost_estimate xs:long query_cost_estimate - Query cost estimate
query_data_tag_list xs:string(32) query_data_tag_list - Query data tag list
reclaim_wait_time xs:long reclaim_wait_time - Reclaim wait time monitor element
routine_id xs:long routine_id - Routine ID. For CALL statements provides the routine identifier for the target procedure. For all other types of statements the value is 0.
rows_deleted xs:long rows_deleted - Rows deleted monitor element
rows_inserted xs:long rows_inserted - Rows inserted monitor element
rows_modified xs:long rows_modified - Rows modified
rows_read xs:long rows_read - Rows read
rows_returned xs:long rows_returned - Rows returned
rows_updated xs:long rows_updated - Rows updated monitor element
section_number xs:short section_number - Section number. This element is not produced if the statement is dynamic.
section_type xs:string(1) section_type - Section type indicator.
semantic_env_id xs:long semantic_env_id - Query semantic compilation environment ID monitor element
sort_consumer_heap_top xs:long sort_consumer_heap_top - Individual private sort heap consumer high watermark
sort_consumer_shrheap_top xs:long sort_consumer_shrheap_top - Individual shared sort heap consumer high watermark
sort_heap_top xs:long sort_heap_top - Sort private heap high watermark
sort_overflows xs:long sort_overflows - Sort overflows
sort_shrheap_top xs:long sort_shrheap_top - Sort share heap high watermark
spacemappage_reclaim_wait_time xs:long spacemappage_reclaim_wait_time - Space map page reclaim wait time monitor element
stmt_exec_time xs:long stmt_exec_time - Statement execution time
stmt_pkg_cache_id xs:long stmt_pkgcache_id - Statement package cache identifier
stmt_text xs:string(2097152) stmt_text - SQL statement text
stmt_type_id xs:string stmt_type_id - Statement type identifier
stmt_value_data xs:string(32768) stmt_value_data - Value data
stmt_value_index xs:nonNegativeInteger stmt_value_index - Value index
stmt_value_isnull xs:string(20) stmt_value_isnull - Value has null value
stmt_value_isreopt xs:string(20) stmt_value_isreopt - Variable used for statement reoptimization
stmt_value_type xs:string(255) stmt_value_type - Value type
stmtid xs:long stmtid - Query statement ID monitor element
stmtno xs:int stmtno - Statement number monitor element
thresh_violations xs:long thresh_violations - Number of threshold violations
total_act_time xs:long total_act_time - Total activity time
total_act_wait_time xs:long total_act_wait_time - Total activity wait time
total_app_section_executions xs:long total_app_section_executions - Total section executions
total_col_executions xs:nonNegativeInteger total_col_executions - Total column-organized executions
total_col_proc_time xs:nonNegativeInteger total_col_proc_time - Total column-organized processing time
total_col_time xs:nonNegativeInteger total_col_time - Total column-organized time
total_col_vector_consumers xs:long total_col_vector_consumers - Total columnar_vector consumers
total_cpu_time xs:long total_cpu_time - Total CPU time
total_disp_run_queue_time xs:long total_disp_run_queue_time - Total dispatcher run queue time
total_extended_latch_wait_time xs:nonNegativeInteger total_extended_latch_wait_time - Total extended latch wait time
total_extended_latch_waits xs:nonNegativeInteger total_extended_latch_waits - Total extended latch waits
total_hash_grpbys xs:long total_hash_grpbys - Total hash group by operations
total_hash_joins xs:long total_hash_joins - Total Hash Joins monitor element
total_hash_loops xs:long total_hash_loops - Total Hash Loops monitor element
total_index_build_proc_time xs:long total_index_build_proc_time - Total non-wait time spent building indexes due to index creation
total_index_build_time xs:long total_index_build_time - Total time spent building indexes due to index creation
total_indexes_built xs:long total_indexes_built - Total number of indexes built
total_olap_funcs xs:long total_olap_funcs - Total OLAP Functions monitor element
total_peas xs:long total_peas - Total partial early aggregations
total_peds xs:long total_peds - Total partial early distincts
total_routine_invocations xs:long total_routine_invocations - Total routine invocations
total_routine_non_sect_proc_time xs:long total_routine_non_sect_proc_time - Non-section processing time
total_routine_non_sect_time xs:long total_routine_non_sect_time - Non-section routine execution time
total_routine_time xs:long total_routine_time - Total routine time
total_routine_user_code_proc_time xs:long total_routine_user_code_proc_time - Total routine user code processing time
total_routine_user_code_time xs:long total_routine_user_code_time - Total routine user code time
total_section_proc_time xs:long total_section_proc_time - Total section processing time
total_section_sort_proc_time xs:long total_section_sort_proc_time - Total section sort processing time
total_section_sort_time xs:long total_section_sort_time - Total section sort time
total_section_sorts xs:long total_section_sorts - Total section sorts
total_section_time xs:long total_section_time - Total section time
total_sorts xs:long total_sorts - Total Sorts
total_stats_fabrication_time xs:nonNegativeInteger total_stats_fabrication_time - Total statistics fabrication time
total_stats_fabrications xs:nonNegativeInteger total_stats_fabrications - Total statistics fabrications
total_sync_runstats_time xs:nonNegativeInteger total_sync_runstats_time - Total synchronous RUNSTATS time
total_sync_runstats xs:nonNegativeInteger total_sync_runstats - Total synchronous RUNSTATS activities
tq_sort_heap_rejections xs:long tq_sort_heap_rejections - Table queue sort heap rejections
tq_sort_heap_requests xs:long tq_sort_heap_requests - Table queue sort heap requests
tq_tot_send_spills xs:long tq_tot_send_spills - Total number of table queue buffers overflowed
valid xs:string(1) valid - Section validity indicator
wlm_queue_assignments_total xs:long wlm_queue_assignments_total - Workload manager total queue assignments
wlm_queue_time_total xs:long wlm_queue_time_total - Workload manager total queue time

Usage notes

The metrics returned by this function represent the accumulation of all metrics for statements in the package cache. Statement metrics are rolled up to the package cache upon activity completion.

The schema for the XML document that is returned in the DETAILS column is available in the file sqllib/misc/DB2MonRoutines.xsd. Further details can be found in the file sqllib/misc/DB2MonCommon.xsd.

Examples

The first example demonstrates how to examine the package cache and select the 10 statements that have read and returned the largest number of rows. Additionally, the results show the cumulative amount of time spent executing each of these statements (in the STMT_EXEC_TIME output column).

SELECT SUBSTR(DETMETRICS.STMT_TEXT, 1, 40) STMT_TEXT,
       DETMETRICS.ROWS_RETURNED, 
       DETMETRICS.STMT_EXEC_TIME   
FROM TABLE(MON_GET_PKG_CACHE_STMT_DETAILS(CAST(NULL AS CHAR(1)),
    CAST(NULL AS VARCHAR(32) FOR BIT DATA), 
    CAST(NULL AS CLOB(1K)), -1)) AS STMT_METRICS,
    XMLTABLE (XMLNAMESPACES( DEFAULT 'http://www.ibm.com/xmlns/prod/db2/mon'),
       '$DETMETRICS/db2_pkg_cache_stmt_details' PASSING 
    XMLPARSE(DOCUMENT STMT_METRICS.DETAILS) as "DETMETRICS"
    COLUMNS "STMT_TEXT" CLOB PATH 'stmt_text', 
        "ROWS_RETURNED" BIGINT PATH 'activity_metrics/rows_returned',
        "STMT_EXEC_TIME" BIGINT PATH 'activity_metrics/stmt_exec_time'
    ) AS DETMETRICS
ORDER BY rows_returned DESC
FETCH FIRST 10 ROWS ONLY

The following is an example of output from this query.

STMT_TEXT                                ROWS_RETURNED STMT_EXEC_TIME
---------------------------------------- ------------- --------------
SELECT CREATOR, NAME, CTIME FROM SYSIBM.           134            38
SELECT SUBSTR(DETMETRICS.STMT_TEXT, 1, 4            44           336
SELECT SUBSTR(DETMETRICS.STMT_TEXT, 1, 4            10           333
SELECT COLNAME, TYPENAME FROM  SYSCAT.CO            10             6
SELECT SUBSTR(DETMETRICS.STMT_TEXT, 1, 4            10           334
SELECT TRIGNAME FROM  SYSCAT.TRIGGERS WH             8             1
SELECT COUNT(*) FROM SYSCAT.TABLESPACES              2             0
SELECT POLICY FROM SYSTOOLS.POLICY WHERE             1             0
CALL SYSPROC.POLICY_INSTALL ('I','DB2Tab             1            62
CALL SYSPROC.POLICY_INSTALL ('I','DB2Tab             1            64

  10 record(s) selected.

The second example shows, for dynamic SQL statements that have waited on a lock while executing, the number of executions, number of lock waits and average time spent per lock wait. The output shows values accumulated over the lifetime of the package cache entries, but restricts information to statements that have executed within the last minute (by setting the modified_within argument tag to 1). The query excludes the statement details (stmt_text and comp_env_desc data) because they are not required and they are computationally expensive to report (by setting the stmt_details argument tag to false).

SELECT NUM_EXEC_WITH_METRICS, LOCK_WAITS, 
  (LOCK_WAIT_TIME / LOCK_WAITS) AVG_LOCK_WAIT_TIME
FROM TABLE(MON_GET_PKG_CACHE_STMT_DETAILS('D', CAST(NULL
   AS VARCHAR(32) FOR BIT DATA), 
   CLOB(
      '<modified_within>1</modified_within><stmt_details>false</stmt_details>')
        , -1))
   AS STMT_METRICS, 
   XMLTABLE (XMLNAMESPACES( DEFAULT 'http://www.ibm.com/xmlns/prod/db2/mon'),
      '$DETMETRICS/db2_pkg_cache_stmt_details' PASSING 
   XMLPARSE(DOCUMENT STMT_METRICS.DETAILS) as "DETMETRICS" 
   COLUMNS "NUM_EXEC_WITH_METRICS" BIGINT PATH 'num_exec_with_metrics',
      "LOCK_WAITS" BIGINT PATH 'lock_waits',          
      "LOCK_WAIT_TIME" BIGINT PATH 'activity_metrics/lock_wait_time'
   ) AS DETMETRICS 
WHERE LOCK_WAITS <> 0 
ORDER BY AVG_LOCK_WAIT_TIME DESC

The following is an example of output from this query.

NUM_EXEC_WITH_METRICS LOCK_WAITS           AVG_LOCK_WAIT_TIME       
--------------------- -------------------- --------------------
                    4                    2                  139
                    9                    3                   90