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.

DPSI indexes provide an alternative to non-partitioned secondary indexes<br />

(NPSIs). There are some areas where NPSI indexes can cause per<strong>for</strong>mance<br />

and contention problems, namely, availability and partition-level operations.<br />

NPSIs can also result in significant contention while executing a query in parallel,<br />

since each parallel task must route through the same single B-tree index<br />

structure to access the separate data partitions. There<strong>for</strong>e, DPSIs can improve<br />

parallelism per<strong>for</strong>mance. If a table and all its indexes are partitioned, then the<br />

data in separate partitions can be accessed in parallel.<br />

However, DPSIs will not always improve query per<strong>for</strong>mance and may, in fact,<br />

cause query per<strong>for</strong>mance degradation. Queries against DPSIs that do not<br />

include predicates against the leading partitioning column are likely to<br />

experience per<strong>for</strong>mance degradation due to the need to probe each partition of<br />

the index <strong>for</strong> values that satisfy the predicate. Queries with predicates against<br />

the secondary index that also restrict the query to a subset of the partitions (by<br />

having predicates against the leading partition column) should see a benefit.<br />

So again, you must know the queries that will be executing against your<br />

DataStore object in order to make an in<strong>for</strong>med decision about whether to use<br />

DPSIs. If you do use them, you must decide which columns to include in the<br />

DPSI. The decision to use a NPSI or DPSI must take into account both data<br />

maintenance practices and the access patterns of the data. We recommend<br />

replacing an existing NPSI with a DPSI only if there are perceivable benefits,<br />

such as easier data or index maintenance, improved data or index availability, or<br />

improved per<strong>for</strong>mance.<br />

Using DPSIs <strong>for</strong> DataStore objects<br />

For DataStore objects, DPSIs should only be considered if queries against the<br />

DataStore object generally contain restrictive predicates against the partitioning<br />

columns (most important is the leading column of the partitioning key) or if the<br />

number of partitions is small (<strong>for</strong> example, 10 or less) and parallelism will be<br />

exploited.<br />

Let us look again at the DataStore object query discussed earlier in this chapter.<br />

Assume that CALMONTH is chosen as the partitioning key. If it always exists in<br />

queries, then we recommend that the index CURTYPE, ACCT_ASGN,<br />

/<strong>BI</strong>C/ZMATLPLNT, PLANT be created as a data partitioned secondary index.<br />

The local predicates of CALMONTH (and CURTYPE) would restrict the query to<br />

a small subset of partitions.<br />

<strong>SAP</strong> does not support the creation of DPSI indexes yet. They must be created<br />

with native SQL within <strong>DB2</strong>. Use the PARTITIONED keyword on the CREATE<br />

INDEX statement to create a data partitioned secondary index.<br />

Chapter 7. <strong>Best</strong> practices <strong>for</strong> DataStore 113

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

Saved successfully!

Ooh no, something went wrong!