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.

The ratio (ST04 statement cache “rows examined”/QDBSEL) is the number of<br />

rows examined <strong>for</strong> each row that satisfied the predicates. If this is high, it can be<br />

a sign of access path problems caused by predicate columns without indexes, or<br />

that <strong>DB2</strong> is not able to use a filtering predicate early in the query to reduce the<br />

number of candidate rows.<br />

When a query is run with indexes that filter the result early and effectively, this<br />

ratio may be as low as 5 or 10. By itself, this ratio is not a reliable indicator of<br />

per<strong>for</strong>mance problems. For example, if a query contains a small table without a<br />

good index, the table may be repeatedly scanned and this ratio will be high, but<br />

the query may still run very quickly, since scanning a few dozen rows of a table in<br />

memory is fast. If you find a query that is slow, and where this ratio is high (<strong>for</strong><br />

example, 100–500, or more), then use the ST04 Explain tool.<br />

8.4 <strong>DB2</strong> Visual Explain<br />

There is an alternative way to interpret the plan table output manually. You may<br />

want to consider <strong>using</strong> <strong>DB2</strong> Visual Explain. It is a software tool that lets you view<br />

and analyze <strong>DB2</strong> access paths graphically to facilitate your analysis and tuning<br />

of SQL queries or statements.<br />

The tool offers suggestions <strong>for</strong> improving the per<strong>for</strong>mance of your SQL queries<br />

or statements. You can change an SQL statement and dynamically explain it to<br />

see whether the access path is improved by the change. You can also use this<br />

tool to browse the current values of the subsystem parameters.<br />

<strong>DB2</strong> Visual Explain makes Distributed Relational Database Architecture<br />

(DRDA) queries through a <strong>DB2</strong> client on the (<strong>for</strong> example, Microsoft® Windows)<br />

workstation to get the in<strong>for</strong>mation it needs. The subsystem parameter values are<br />

retrieved by calling a stored procedure on the host, which makes an IFI call to the<br />

appropriate <strong>DB2</strong> trace record and returns them to the workstation.<br />

Basically, <strong>DB2</strong> Visual Explain helps database administrators and application<br />

developers do the following:<br />

► See the access path <strong>for</strong> a given SQL statement.<br />

► Tune SQL statements <strong>for</strong> better per<strong>for</strong>mance.<br />

► View the current values <strong>for</strong> subsystem parameters.<br />

174 <strong>Best</strong> <strong>Practices</strong> <strong>for</strong> <strong>SAP</strong> <strong>BI</strong> <strong>using</strong> <strong>DB2</strong> 9 <strong>for</strong> z/<strong>OS</strong>

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

Saved successfully!

Ooh no, something went wrong!