19.06.2013 Views

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Options <strong>for</strong> cardinality and distribution statistics<br />

To support these new functionalities, several new options are introduced in the RUNSTATS<br />

utility. New keywords COLGROUP, LEAST, M<strong>OS</strong>T and BOTH enable the collection of<br />

distribution statistics on any table column and group of columns. The existing keywords<br />

FREQVAL and COUNT also can be used. You can specify the following options <strong>for</strong> collecting<br />

cardinality and distribution statistics:<br />

► COLGROUP: When you specify the COLGROUP keyword, the specified set of columns is<br />

treated as a group and RUNSTATS collects correlation statistics <strong>for</strong> the specified column<br />

group. You can specify the COLGROUP keyword repeatedly, if you want to collect<br />

statistics on a different set of columns.<br />

► FREQVAL: This keyword controls the collection of frequent value statistics. These are<br />

collected either on the column group or on individual columns depending on whether<br />

COLGROUP is specified or not. You can specify the FREQVAL keyword together with the<br />

NUMCOLS keyword when you run RUNSTATS INDEX. But when you run table-level<br />

statistics, FREQVAL can only be specified together with the COLGROUP keyword. If<br />

FREQVAL is specified, then it must be followed by the keyword COUNT.<br />

► COUNT: This indicates the number of frequent values to be collected. Specifying an<br />

integer value of 20 means to collect 20 frequent values <strong>for</strong> the specified columns. No<br />

default value is assumed <strong>for</strong> COUNT. This can be optionally followed by the keyword<br />

M<strong>OS</strong>T (which is the default), LEAST, or BOTH.<br />

Note: The following statement:<br />

RUNSTATS TABLESPACE DBGBTEST.TSGBRUNS<br />

TABLE(ALL) INDEX(ALL) KEYCARD<br />

does collect FREQVAL values on the indexes by default.<br />

If you do not want to collect any FREQVAL data, you need to specify the following<br />

options:<br />

RUNSTATS TABLESPACE DBGBTEST.TSGBRUNS<br />

TABLE(ALL) INDEX(ALL) KEYCARD<br />

FREQVAL NUMCOLS 1 COUNT 0<br />

► M<strong>OS</strong>T: The most frequent values are collected when the keyword M<strong>OS</strong>T is specified.<br />

► LEAST: The least frequent values are collected when the keyword LEAST is specified.<br />

► BOTH: The most frequent values and the least frequent values are collected when the<br />

keyword BOTH is specified.<br />

Options <strong>for</strong> using sort work data sets<br />

When you are collecting distribution statistics <strong>for</strong> column groups or collecting statistics on a<br />

data-partitioned secondary index, <strong>for</strong> example, it is necessary <strong>for</strong> <strong>DB2</strong> to use sort work to sort<br />

the statistics. As a new option of V8, you can specify the SORTDEVT and SORTNUM<br />

keywords <strong>for</strong> using dynamic allocation of the sort work data sets:<br />

► SORTDEVT: This specifies the device type that DFSORT uses to dynamically allocate the<br />

sort work data set.<br />

► SORTNUM: This specifies the number of required sort work data sets that DFSORT is to<br />

allocate.<br />

If you do not use dynamic allocation <strong>for</strong> the SORT program, and if you collect the statistics <strong>for</strong><br />

which sort data is required, you have to define data sets through JCL. You need to specify<br />

ST01WKnn and STATWK01 in DD statements depending on the statistics you collect:<br />

274 <strong>DB2</strong> <strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 Per<strong>for</strong>mance <strong>Topics</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!