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.

RUNSTATS<br />

option<br />

TABLE 137 140 115 118 -16.06 -15.72<br />

TABLE and 6<br />

INDEXES<br />

6.4.2 DSTATS<br />

<strong>DB2</strong> V7 (sec.) <strong>DB2</strong> V8 (sec.) Delta CPU Delta ET<br />

CPU Elapsed CPU Elapsed % %<br />

189 193 168 173 -11.12 -10.37<br />

The RUNSTATS utility has been enhanced in V8 and can collect distribution statistics on any<br />

column or groups of columns, indexed or non-indexed columns, specified by table level. This<br />

enhancement lets the <strong>DB2</strong> optimizer calculate more accurately the filter factor of a query and<br />

helps to improve SQL per<strong>for</strong>mance.<br />

For versions prior to V8 you can use a tool called DSTATS (Distribution Statistics <strong>for</strong> <strong>DB2</strong> <strong>for</strong><br />

<strong>OS</strong>/390) which you can download from the Web site:<br />

http://www.ibm.com/support/docview.wss?uid=swg24001598<br />

This tool is available <strong>for</strong> use with <strong>DB2</strong> V5, V6, and V7. DSTATS is a standalone <strong>DB2</strong><br />

application program, written in PL/I, which contains dynamic and static SQL statements. The<br />

tool collects additional statistics on column distributions and column frequencies that were not<br />

collected by RUNSTATS be<strong>for</strong>e <strong>DB2</strong> V8. With <strong>DB2</strong> V8, equivalent function is provided by the<br />

RUNSTATS utility. The enhanced RUNSTATS utility collects additional in<strong>for</strong>mation on column<br />

distribution and frequencies, and updates the <strong>DB2</strong> catalog with the more accurate statistics. It<br />

greatly enhances the per<strong>for</strong>mance of the query if there are non-uni<strong>for</strong>m data distributions in<br />

your tables or indexes.<br />

6.4.3 Description of distribution statistics in V8<br />

When there is a skewed distribution of values <strong>for</strong> a certain column, this can cause bad<br />

response time of a query, especially in ad hoc query applications. The collection of correlation<br />

and skew statistics <strong>for</strong> non-leading indexed columns and non-indexed columns can help the<br />

optimizer to compute accurate filter factors. This leads to better access path selection and<br />

improves query per<strong>for</strong>mance.<br />

The enhancement of the RUNSTATS utility allows you to use RUNSTATS to collect distribution<br />

statistics on any column in your tables, whether or not the columns are part of an index, and<br />

whether or not the columns are the leading columns of an index. It updates the <strong>DB2</strong> catalog<br />

with the specified number of highest frequencies and optionally with the specified number of<br />

lowest frequencies. The new functionality also optionally collects multi-column cardinality <strong>for</strong><br />

non-indexed column groups and updates the catalog.<br />

The summary of the new functionality of RUNSTATS is as follows:<br />

► Collect distribution statistics on any column, or groups of columns, indexed or<br />

non-indexed, specified at the table level<br />

► Frequency distributions <strong>for</strong> non-indexed columns or groups of columns<br />

► Cardinality values <strong>for</strong> groups of non-indexed columns<br />

► LEAST frequently occurring values, along with M<strong>OS</strong>T frequently occurring values, <strong>for</strong> both<br />

index and non-indexed column distributions (<strong>DB2</strong> V7 only gathers the most frequently<br />

occurring value)<br />

Chapter 6. Utilities 273

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

Saved successfully!

Ooh no, something went wrong!