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.

3.5.1 Per<strong>for</strong>mance<br />

SORTDEVT SYSDA<br />

INDEX(SYS<strong>IBM</strong>.DSNDSX01,<br />

SYS<strong>IBM</strong>.SQLDTX01,<br />

SYS<strong>IBM</strong>.DSNDTX01,<br />

SYS<strong>IBM</strong>.DSNDTX03,<br />

SYS<strong>IBM</strong>.DSNDTX02 KEYCARD,<br />

HAA.TABLEIX)<br />

SHRLEVEL CHANGE REPORT YES<br />

Note that the RUNSTATS suggested by the Statistics Advisor specifies the new COLGROUP<br />

option introduced in V8 to collect frequency in a column group. For the table<br />

SYS<strong>IBM</strong>.SYSTABLESPACE the statistic is <strong>for</strong> the column NAME used as a predicate in the<br />

correlated subquery to have a better filter factor estimate. The statistic <strong>for</strong> indexes specifies<br />

one index <strong>for</strong> SYSTABLESPACE and five indexes <strong>for</strong> SYSTABLES.<br />

You may consider executing RUNSTATS to collect these statistics.<br />

In <strong>DB2</strong> V8, RUNSTATS can collect the most and least frequently occurring frequencies on<br />

almost any column or column group. RUNSTATS can also collect multi-column cardinality on<br />

almost any column group. See also 6.4, “RUNSTATS enhancements” on page 272.<br />

In many queries there are predicates on some matching and some screening columns. You<br />

can collect statistics to better reflect the total index filtering. When you have correlations and<br />

skews on some indexed and some non-indexed columns, you can collect statistics so the<br />

optimizer can more accurately estimate the number of rows which qualify from the table.<br />

The statistics that can be collected are:<br />

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

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

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

column distributions<br />

The new keywords: COLGROUP, M<strong>OS</strong>T, LEAST, BOTH, SORTNUM, and SORTDEVT<br />

Better filter factor estimation in V8<br />

<strong>DB2</strong> V8 can estimate a better filter factor by using statistics inference derivation. This can<br />

result in with or without the additional statistics mentioned earlier:<br />

► Improved query selectivity estimation using statistical inference on available statistics,<br />

when applicable<br />

► Queries which contain two or more predicates referencing a table may get better access<br />

paths<br />

► Significant per<strong>for</strong>mance improvement <strong>for</strong> some complex queries<br />

► Consider rebinding this type of query<br />

The per<strong>for</strong>mance measurements show the benefits with statistics on multiple columns.<br />

Better filter factor estimation<br />

Statistics on predicate columns allow the <strong>DB2</strong> optimizer to select a better access path as<br />

reported in the example in Figure 3-30.<br />

74 <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!