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.

3.4.3 Per<strong>for</strong>mance<br />

► char/varchar(n1)-> char/varchar(n2)<br />

– where n1>n2 and not equal predicate<br />

► graphic/vargraphic(n1) -> graphic/vargraphic(n2)<br />

– where n1>n2 and not equal predicate<br />

► char/varchar(n1) -> graphic/vargraphic(n2)<br />

– where n1>n2 and not equal predicate<br />

Per<strong>for</strong>mance measurements were made to show the type of benefits that can be achieved<br />

using mismatched numeric data types and mismatched string types in predicates that were<br />

stage 2 in V7 and are stage 1 in V8.<br />

Mismatched numeric data types<br />

The measured query is a count of the rows of a result set of a SELECT joining two tables<br />

where the columns in the join predicate are INTEGER and DEC(8).<br />

Figure 3-27 shows the SQL text executed in V7 (with DEGREE(1) and DEGREE(ANY)) and<br />

V8, the PLAN_TABLE indicating the usage of an index to execute the join, and the measured<br />

elapsed and CPU times. The tables used here are the same as in Figure 3-13 on page 50.<br />

Mismatched numeric data types<br />

SELECT COUNT(*) FROM CV, PL<br />

WHERE PL.LP = 19861025<br />

AND CV.CS = PL. LP;<br />

Data type of LP is DEC(8)<br />

Index PLIX on LP column<br />

Data type of CS is INT<br />

Index CVIX on CS column<br />

V7 PLAN_TABLE<br />

IXNAME METHOD MATCHCOL<br />

CVIX<br />

PLIX<br />

Figure 3-27 Mismatched numeric data types<br />

0<br />

1<br />

V8 PLAN_TABLE<br />

IXNAME METHOD MATCHCOL<br />

PLIX<br />

CVIX<br />

0<br />

1<br />

0<br />

1<br />

1<br />

1<br />

Elapsed sec CPU sec<br />

The columns involved in this equi-join have different numeric data types: Column LP is<br />

DEC(8) and column CS is INT.<br />

V7 shows that table CV is joined with table PL using the nested loop join method. PL is<br />

accessed via a one column matching index only access. CV is accessed via a non-matching<br />

index only access that results in reading all leaf pages in the index.<br />

9<br />

8<br />

7<br />

6<br />

5<br />

4<br />

3<br />

2<br />

1<br />

0<br />

V7 DEGREE(1)<br />

V7 DEGREE(ANY)<br />

V8 DEGREE(1)<br />

6X<br />

16<br />

X<br />

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

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

Saved successfully!

Ooh no, something went wrong!