19.06.2013 Views

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - 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.

Sparse Index<br />

T1<br />

Binary Search<br />

Figure 3-18 Sparse index on work file<br />

NLJ<br />

t1.c = t2.c<br />

Key RID<br />

With a sparse index there is a binary search to find the entry <strong>for</strong> the key searched in memory<br />

and scans a few rows in the work file.<br />

Sparse index on work file:<br />

► Made available in <strong>DB2</strong> V7 via APAR PQ61458<br />

► Enhanced in <strong>DB2</strong> V8, sort key and a 5 byte RID<br />

► Sparse indexes are built in cache when they are sorted in join column order<br />

► Cache up to 240 KB in memory in thread local storage pool<br />

► Probed through an equal-join predicate<br />

► New ACCESSTYPE='T' in PLAN_TABLE <strong>for</strong> sparse index access as well as <strong>for</strong> IMWF<br />

► Nested-loop join can be used <strong>for</strong> inside-out phase of star join<br />

Sparse index <strong>for</strong> star join<br />

Figure 3-19 shows the use of a sparse index in the inside-out phase in a star join.<br />

With the sparse index the access path can be changed to avoid sort-merge-join in the<br />

inside-out phase:<br />

► Use of a multi-column fact table index during outside-in phase<br />

► Use of a sparse index during inside-out phase<br />

RID<br />

... ...<br />

T2 (WF)<br />

T2<br />

(WF)<br />

Sorted in t2.c order<br />

As a result there is no longer the need to sort a large composite file (no sort work file space<br />

requirement) and reduction of the overhead (merge and repartition) caused by sort.<br />

Chapter 3. SQL per<strong>for</strong>mance 59

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

Saved successfully!

Ooh no, something went wrong!