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.

But not all mismatched numeric types become stage 1. The exceptions that are still stage 2<br />

predicates are:<br />

► REAL -> DEC(p,s) where p >15<br />

where REAL is the right hand side predicate -> DEC(p,s) is the left hand side predicate<br />

► FLOAT -> DEC(p,s) where p >15<br />

– REAL or FLOAT column in the outer table of a join<br />

– REAL or FLOAT literal or host variable<br />

DEC_column > REAL_hostvar<br />

REAL and FLOAT values cannot be converted to decimal (the index column) with precision ><br />

15 without possibly changing the collating sequence.<br />

Mismatched string types<br />

Figure 3-26 shows examples of mismatched string types that were stage 2 in V7 and are<br />

stage 1 and indexable in V8 CM.<br />

Example of mismatched string types<br />

SELECT * FROM employee<br />

WHERE deptid = :HV ;<br />

Figure 3-26 Example of mismatched string types<br />

In the example, the selection of rows from the employee table has to scan the table space in<br />

V7 because the column DEPTID is defined as CHAR(3) and is compared to a string of four<br />

characters. This is a stage 2 predicate in <strong>DB2</strong> V7.<br />

The same predicate is stage 1 in V8 and it allows a matching index scan.<br />

Not all mismatched string types become stage 1. The exceptions that are still stage 2<br />

predicates are:<br />

► graphic/vargraphic -> char/varchar<br />

where, <strong>for</strong> example, graphic is the right hand side predicate -> char is the left hand side<br />

predicate<br />

68 <strong>DB2</strong> <strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 Per<strong>for</strong>mance <strong>Topics</strong><br />

SELECT * FROM employee<br />

WHERE deptid = 'M60A' ;<br />

in V7<br />

or<br />

Stage-2 predicate<br />

Tablespace scan<br />

CHAR(3)<br />

V8<br />

:HV > 3 bytes<br />

Stage-1 predicate<br />

Could use index on<br />

deptid column

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

Saved successfully!

Ooh no, something went wrong!