MON_GET_INDEX table function - get index metrics
The MON_GET_INDEX table function returns metrics for one or more indexes.
Syntax
The schema is SYSPROC.
Table function parameters
-
tabschema
- An input argument of type VARCHAR(128) that specifies a valid table schema name in the same database as the one currently connected to when calling this function. If the argument is NULL or an empty string, metrics are retrieved for indexes of tables in all schemas in the database. If the argument is specified, metrics are only returned for indexes for tables in the specified schema. tabname
- An input argument of type VARCHAR(128) that specifies a valid table name in the same database as the one currently connected to when calling this function. Metrics are returned for all indexes on the specified table. If the argument is null or an empty string, metrics are retrieved for all indexes for all tables in the database. member
- An input argument of type INTEGER that specifies a valid member in the same instance as the currently connected database when calling this function. Specify a -1 for the current database member, or -2 for all active database members. If the NULL value is specified, -1 is set implicitly
Authorization
- EXECUTE privilege on the routine
- DATAACCESS authority
- DBADM authority
- SQLADM authority
Default PUBLIC privilege
None
Example
Identify the most frequently used indexes on the DMEXT002.TABLE1 table, since the last database activation:
SELECT VARCHAR(S.INDSCHEMA, 10) AS INDSCHEMA,
VARCHAR(S.INDNAME, 10) AS INDNAME,
T.DATA_PARTITION_ID,
T.MEMBER,
T.INDEX_SCANS,
T.INDEX_ONLY_SCANS
FROM TABLE(MON_GET_INDEX('DMEXT002','TABLE1', -2)) as T, SYSCAT.INDEXES AS S
WHERE T.TABSCHEMA = S.TABSCHEMA AND
T.TABNAME = S.TABNAME AND
T.IID = S.IID
ORDER BY INDEX_SCANS DESC
The following is an example of output from this query.
INDSCHEMA INDNAME DATA_PARTITION_ID MEMBER INDEX_SCANS INDEX_ONLY_SCANS
---------- ---------- ----------------- -------------- -------------------- --------------------
DMEXT002 INDEX3 - 0 1 1
DMEXT002 INDEX4 - 0 1 0
DMEXT002 INDEX1 - 0 0 0
DMEXT002 INDEX2 - 0 0 0
DMEXT002 INDEX5 - 0 0 0
DMEXT002 INDEX6 - 0 0 0
6 record(s) selected.
Usage notes
The MON_GET_INDEX table function returns one row of data per index, and per database member. If partitioned indexes are being used, one row is returned for each index partition per database member. No aggregation across database members is performed. However, aggregation can be achieved through SQL queries as shown in the previous example.
Metrics will only be returned for indexes on tables that have been accessed since the database was activated. All counters represent data since the current database activation. For example, the pseudo_empty_pages counter is the number of pages that have been identified as pseudo empty since the database was activated. it is not the current number of pseudo empty pages in the index.
The metrics returned by this function are collected at two levels. Some metrics are always collected, while the collection of other metrics is controlled at the database level by using the mon_obj_metrics configuration parameter. Refer to the descriptions provided in the following table to determine if any settings must be active for data to be collected for a particular metric.