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.

is run on an empty table (dimension or fact), and statistics have not been<br />

updated since.)<br />

If statistics are current, and the access path does not match with the counts such<br />

that the most filtering dimension/snowflake is accessed be<strong>for</strong>e the facttable, then<br />

the most likely scenario is either:<br />

► The dimension/snowflake chosen be<strong>for</strong>e the facttable has had its filtering<br />

overestimated (so the filtering looks better than it actually is).<br />

► The good dimension/snowflake (not chosen be<strong>for</strong>e the facttable) has had its<br />

filtering underestimated (so the filtering looks worse than it actually is).<br />

For in<strong>for</strong>mation about analyzing and determining the actual cause, refer to 8.3,<br />

“Analyzing query per<strong>for</strong>mance” on page 157.<br />

10.3 Indexing of DSOs<br />

Query per<strong>for</strong>mance on DSO objects can be greatly influenced by having<br />

appropriate indexes on the DSO tables. When a DSO object is created within<br />

<strong>SAP</strong>, only one index is created. This is a primary index, which is usually<br />

comprised of all the key fields of the DSO object.<br />

This index most likely will not provide optimal per<strong>for</strong>mance <strong>for</strong> the queries being<br />

executed against the DSO. Secondary indexes should be created. However,<br />

keep in mind that there is a cost to maintaining indexes. This cost is mostly<br />

incurred during the load DSO phase. There<strong>for</strong>e, index design is important and it<br />

depends on the queries that will be executed against the DSO. The point is to<br />

create indexes that are worth the cost of maintenance.<br />

The objective of indexing on the DSO is to minimize the number of DSO table<br />

rows that must be accessed to produce the final result. The closer the number of<br />

rows retrieved is to the number of rows returned by the query, the better the<br />

per<strong>for</strong>mance should be. There<strong>for</strong>e, indexes should be designed to support the<br />

most filtering of rows. This is more important than the number of matching<br />

columns in an index.<br />

Let us look at the DSO query that is analyzed in 10.1, “SQL efficiency <strong>for</strong> DSO”<br />

on page 204, and see how additional indexes on the tables accessed can<br />

influence the per<strong>for</strong>mance of the query.<br />

The WHERE clause of this query consists of the following predicates, which<br />

proved to provide the greatest degree of filtering:<br />

WHERE "/<strong>BI</strong>C/AZ<strong>OS</strong>ASALE00"."/<strong>BI</strong>C/ZMATLPLNT" =<br />

"/<strong>BI</strong>C/XZMATLPLNT"."/<strong>BI</strong>C/ZMATLPLNT"<br />

Chapter 10. Tips <strong>for</strong> SQL efficiency 219

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

Saved successfully!

Ooh no, something went wrong!