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.14.2 Conclusion<br />

Percent reduction<br />

Figure 3-46 Multiple DISTINCT per<strong>for</strong>mance<br />

Multiple DISTINCT keywords in a single SELECT statement in V8 can largely enhance<br />

application per<strong>for</strong>mance, as well as usability of SQL. Specifying four distinct columns in one<br />

statement can make approximately 55% elapsed time improvement and 45% CPU<br />

improvement compared to the total time of the four individual statements. This improvement is<br />

due to reducing the overhead of multiple executions of queries and per<strong>for</strong>ming multiple sorts<br />

<strong>for</strong> multiple distinct columns.<br />

3.14.3 Recommendations<br />

Use multiple DISTINCT keywords in a single SELECT statement in your application as often<br />

as possible, eliminating unnecessary multiple queries. Per<strong>for</strong>mance advantages were found<br />

where there more than two DISTINCT clauses in one query.<br />

3.15 Visual Explain<br />

Visual Explain <strong>for</strong> <strong>DB2</strong> V8 provides graphical depictions of the access plans that <strong>DB2</strong><br />

chooses <strong>for</strong> your SQL queries and statements. Such graphs eliminate the need to manually<br />

interpret the PLAN_TABLE output filled by <strong>DB2</strong> EXPLAIN. See Appendix D, “EXPLAIN and its<br />

tables” on page 407 <strong>for</strong> its contents and the contents of the other EXPLAIN tables. The<br />

relationships between database objects, such as tables and indexes, and operations, such as<br />

table space scans and sorts, are clearly illustrated in the graphs. You can use this in<strong>for</strong>mation<br />

to tune your queries.<br />

Statistics Advisor is a brand new function of Visual Explain, and it is also available from the<br />

Web. Its main function is to help you identify the RUNSTATS executions that help your SQL.<br />

110 <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><br />

Multiple DISTINCT per<strong>for</strong>mance<br />

60<br />

50<br />

40<br />

30<br />

20<br />

10<br />

0<br />

Time reduction when compared to invidual DISTINCTs<br />

1 2 3 4<br />

Number of DISTINCTs in one query<br />

Elapsed Time<br />

CPU Time

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

Saved successfully!

Ooh no, something went wrong!