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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ISCAN<br />

(Mat)<br />

3.3.3 Sparse index<br />

In memory work file (IMWF)<br />

S<br />

Outside-in<br />

SCAN<br />

IMWF<br />

In-memory<br />

workfiles<br />

Figure 3-16 In memory work file - Description<br />

NLJ NLJ<br />

NLJ<br />

SCAN ISCAN SCAN<br />

S S<br />

IMWF<br />

Dimension D (Time)<br />

D (Store)<br />

SALES<br />

(300M)<br />

Inside-out<br />

NLJ +<br />

IMWF<br />

The in memory work file is used <strong>for</strong> caching the data and index keys in a dedicated virtual<br />

memory pool. If IMWF fails (<strong>for</strong> whatever reason), sparse index on the work file is used.<br />

IMWF characteristics:<br />

► IMWF reduces contention on the work file buffer pool<br />

► IMWF reduces CPU and work file I/O<br />

► The memory pool is created only when star join is enabled<br />

► Can specify the maximum pool size via DSNZPARM SJMXPOOL<br />

► SJMXPOOL is changeable from 0 to 1024 MB.<br />

– 20 MB is the default<br />

– Memory pool is allocated at execution time above the bar<br />

► Exact amount of required space is allocated<br />

► The pool contains only the join column and the columns selected<br />

► Binary search via in memory index keys<br />

► If the dedicated pool cannot be allocated or the space in it becomes insufficient to store<br />

the data, the traditional sparse index is used; that is, a work file is created.<br />

In this section we describe the implementation of a sparse index on the work file during star<br />

join execution. The difference between a normal and a sparse index is in the regular index<br />

there is one entry <strong>for</strong> each row in the table and in the sparse index there is one entry <strong>for</strong><br />

several rows that have the same key. Sparse index was first introduced in <strong>DB2</strong> V4 <strong>for</strong><br />

uncorrelated IN subqueries.<br />

► In <strong>DB2</strong> V7 sparse index can only be used during INSIDE-OUT processing<br />

► In <strong>DB2</strong> V8 in both inside-out and outside-in, but only if IMWF cannot be used<br />

IMWF<br />

NLJ<br />

SCAN<br />

IMWF<br />

Dim Dim Dim Dim Dim<br />

NLJ<br />

ISCAN<br />

Dimension<br />

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

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

Saved successfully!

Ooh no, something went wrong!