Calculating space required for METRDATA
The METRDATA data set contains metrics about individual SQL calls at a summary level.
About this task
The level of reduction depends on the values specified in the CQMPARMS OPTKEYS parameters. Without the specification of OPTKEYS the reduction is done on the following input keys:
- Plan
- Program
- Cursor/section
- Statement#
- Statement type
For example, consider a program that contains a dynamic SQL sequence of calls:
100 PREPARE
105 OPEN
110 FETCH
120 CLOSE
130 COMMITIf all the calls in the program are executed 200 times by 200 users, Query Monitor will only create 5 records in the METRDATA data set at interval expiration. However, if Query Monitor is started with OPTKEYS(AUTHIDS), and the same query is executed once by the same 200 users QM will create 1000 records at interval expiration. If the same query is executed twice by each user, Query Monitor will still create 1000 records.
The goal in determining a reasonable amount of space to specify for the primary allocation for the METRDATA data set is to first determine the average number of unique SQL calls that Query Monitor will record in the METRDATA data set at interval expiration.
The other optional keys that maybe specified are CORRID, WSUSER, WSNAME, WSTRAN, and TEXT, which correspond to the correlation id, workstation user, workstation name, workstation transaction and SQL text token respectively. The subparameters of the OPTKEYS startup parameter describe basic DB2® identifiers, but the TEXT sub-parameter describes a unique dynamic SQL statement.
To continue the example, if OPTKEYS(TEXT) is specified and the dynamic SQL program is executed one time, Query Monitor will record 5 records in the METRDATA data set. If the program is executed and prepares and executes 100 distinct SQL statements with the 5 call sequence, then the METRDATA data set will contain 500 records at interval expiration.
To determine the number of tracks needed:
Procedure
- Determine how many records will fit into a control interval
within the METRDATA data set.
- Since the records in the METRDATA data set are fixed in length, subtract 10 bytes from the control interval size for the VSAM control information (2 RDFs of 3 bytes + 1 CIDF of 4 bytes).
- Divide the result obtained from step 1a by the METRDATA record length (1008). Drop any remainder from the calculation.
- Determine the number of control intervals that will fit
on a track.
- Determine how many control intervals are needed. To do so, divide the number of unique SQL calls per interval by the number of records per control interval (calculated in step 1b).
- Determine how many tracks are needed. To do so, divide the number of control intervals required (calculated in step 3) by the number of control intervals per track (calculated in step 2c).