06.01.2013 Views

Download PDF - IBM Redbooks

Download PDF - IBM Redbooks

Download PDF - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

With DB2 10, the new access type NR is chosen on the correct index as shown in Figure 3-13.<br />

Figure 3-13 DB2 10 access path for SQL pagination<br />

The differences in response time are dramatic. Where DB2 9 shows a response time of over<br />

6 seconds, DB2 10 performs the SELECT in under 2 milliseconds, saving an additional over<br />

500 milliseconds of CPU time.<br />

Table 3-2 Evaluation of access type NR<br />

DB2 release Average elapsed time<br />

(ms)<br />

3.5 Safe query optimization<br />

Average processor<br />

time (ms)<br />

DB2 9 6097.04 584.75 5512.29<br />

DB2 10 1.63 0.19 1.45<br />

In DB2 10, the DB2 optimization process considers the uncertainty of predicate filtering when<br />

selecting an index. Now, when two indexes have a close cost estimate, the DB2 optimization<br />

process considers the uncertainty of matching and screening predicates when choosing the<br />

most efficient index. In addition, this release offers improvements to list prefetch processing. 2<br />

By default, at preparation time, SAP uses parameter markers with the REOPT(ONCE) bind<br />

option. The statement is reoptimized for the first set of actual values for the parameter markers.<br />

In most cases, where this approach is a good trade-off between query run time and optimization<br />

overhead, it can lead to adverse effects when the access pattern of the first statement differs<br />

from the main application workload. A typical problem occurs when a table is first accessed for<br />

a client (=MANDT) that has almost no data before the productive client is accessed.<br />

DB2 10 now takes the uncertainty of the predicate filter factors into account when choosing<br />

between two indexes with close cost estimates. Now you can choose an access path that has<br />

a slightly higher cost but provides less risk.<br />

In addition, DB2 does index probing for filter factor calculation to safeguard the access path<br />

selection against outdated or missing statistics for the following cases:<br />

► No statistics are available for the table.<br />

► Statistics say that the table is empty.<br />

► Statistics say that no rows qualify within a partition.<br />

► Statistics say that no rows qualify for a matching predicate.<br />

This mechanism is also used for tables defined as VOLATILE and for tables subject to<br />

NPGTHRSH handling.<br />

50 Running SAP Solutions with <strong>IBM</strong> DB2 10 for z/OS on the <strong>IBM</strong> zEnterprise System<br />

Average wait time (ms)<br />

2 For more information, see “Safe query optimization” in the DB2 10 for z/OS Information Center at:<br />

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.wnew%2F<br />

src%2Ftpc%2Fdb2z_10_safequeryopt.htm

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

Saved successfully!

Ooh no, something went wrong!