07.02.2013 Views

Best Practices for SAP BI using DB2 9 for z/OS - IBM Redbooks

Best Practices for SAP BI using DB2 9 for z/OS - IBM Redbooks

Best Practices for SAP BI using DB2 9 for z/OS - 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.

Global query optimization addresses query per<strong>for</strong>mance problems caused when<br />

<strong>DB2</strong> V8 breaks a query into multiple parts and optimizes each of those parts<br />

independently. While each of the individual parts may be optimized to run<br />

efficiently, when these parts are combined the overall result may be inefficient.<br />

For example, consider the following query:<br />

SELECT * FROM T1<br />

WHERE EXISTS (SELECT 1 FROM T2, T3 WHERE T2.C2 = T3.C2<br />

AND T2.C1 = T1.C1);<br />

<strong>DB2</strong> V8 will break this query into two parts (the correlated subquery and the<br />

outer query), and each of these parts will be optimized independently. The<br />

access path <strong>for</strong> the subquery does not take into account the different ways in<br />

which the table in the outer query may be accessed and vice versa.<br />

<strong>DB2</strong> V8 may choose to do a table scan of T1, resulting in much random I/O when<br />

accessing T2, while a nonmatching index scan of T1 would avoid the random I/O<br />

on T2. In addition, <strong>DB2</strong> will not consider reordering these two parts. The<br />

correlated subquery will always be per<strong>for</strong>med after accessing T1 to get the<br />

correlation value. If T1 is a large table, and T2 is a small table, it may be much<br />

more efficient to access T2 first and then T1 (especially if there is no index on<br />

T2.C1 but here is an index on T1.C1).<br />

In summary, Global Query Optimization will allow <strong>DB2</strong> to optimize a query as a<br />

whole rather than as independent parts. This is accomplished by allowing <strong>DB2</strong><br />

to:<br />

► Consider the effect of one queryblock on another.<br />

► Consider reordering queryblocks.<br />

4.3.2 Cross query block optimization<br />

This new feature addresses query per<strong>for</strong>mance problems caused when <strong>DB2</strong><br />

breaks a query into multiple parts and optimizes each of those parts<br />

independently. The V9 optimizer treats subqueries as virtual tables, which allows<br />

it to do a cross query block optimization.<br />

4.4 Extended sparse index and in-memory workfile<br />

<strong>DB2</strong> 9 introduces the new installation parameter MXDTCACH to specify the<br />

maximum memory allocated <strong>for</strong> data caching. The recommended minimal setting<br />

of MXDTCACH <strong>for</strong> <strong>SAP</strong> <strong>BI</strong> systems is 128 MB. The recommended settings of<br />

new V9 parameters after migration from a V8 <strong>SAP</strong> system are documented in<br />

<strong>SAP</strong> note 1032273.<br />

Chapter 4. Benefits of <strong>DB2</strong> 9 <strong>for</strong> <strong>SAP</strong> <strong>BI</strong> 49

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

Saved successfully!

Ooh no, something went wrong!