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.

problems with optimization. The conflicts threshold tab allows you to control how aggressively<br />

SA can en<strong>for</strong>ce inconsistencies. See Figure 3-59.<br />

Figure 3-59 Conflict statistics threshold setup<br />

Summarizing what the Statistics Advisor can do:<br />

► Automate the analysis of the statistics required <strong>for</strong> an SQL statement. Often a query can<br />

have inefficient or unstable per<strong>for</strong>mance due to lack of statistics.<br />

► Generate a report explaining why you need the recommended RUNSTATS<br />

► Show the statistics conflict that you have in your catalog<br />

► Submit the RUNSTATS using a stored procedure<br />

► Automate the solution to many common SQL per<strong>for</strong>mance problems and solve SQL<br />

per<strong>for</strong>mance problems quickly and easily.<br />

3.15.4 Visual Explain and Statistics Advisor on MQTs<br />

To illustrate, we show screens from Visual Explain and Statistics Advisor taken using one<br />

query from the member DSNTEJ3M (from SDSNSAMP).<br />

Table 3-13 Query using MQT table<br />

Query MQT table<br />

Note: Do not <strong>for</strong>get to set the Current Refresh Age Parameters = Any (from the Visual<br />

Explain - Tune SQL Screen); otherwise, EXPLAIN does not show you the MQTs you are<br />

using.<br />

We put the whole query on Table 3-13 in case you want to do the same tests we did.<br />

SELECT R1.DAY, R1.MONTH, R1.YEAR, R10.CITYID, R7.DIVISIONID, SUM(R15.QUANTITY) SUMQTY,<br />

SUM(R15.C<strong>OS</strong>T) SUMC<strong>OS</strong>T, SUM(R15.AMOUNT) SUMAMT, SUM(R15.AMOUNT) - SUM(R15.C<strong>OS</strong>T) GPROFIT<br />

FROM DSN8810.TIME R1, DSN8810.PRODUCT R5, DSN8810.LOCATION R10, DSN8810.PCATEGORY R6,<br />

DSN8810.SALESFACT R15, DSN8810.PFAMILY R7<br />

WHERE R1.TIMEID = R15.TIMEID AND R5.PRODUCTID = R15.PRODUCTID<br />

AND R5.CATEGORYID = R6.CATEGORYID AND R6.FAMILYID = R7.FAMILYID<br />

AND R10.STOREID = R15.STOREID AND R1.YEAR >= 2000<br />

GROUP BY R1.DAY, R1.MONTH, R1.YEAR, R10.CITYID, R7.DIVISIONID;<br />

Chapter 3. SQL per<strong>for</strong>mance 123

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

Saved successfully!

Ooh no, something went wrong!