18.12.2013 Views

DB2 9 for z/OS Hints and Tips for Application Programmers

DB2 9 for z/OS Hints and Tips for Application Programmers

DB2 9 for z/OS Hints and Tips for Application Programmers

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.

Index on Expression<br />

V8<br />

How to improve per<strong>for</strong>mance of<br />

queries that include expressions<br />

such as in the following examples:<br />

SELECT id<br />

FROM employee<br />

WHERE<br />

UPPER (lastname, 'EN_US') = 'JOE'<br />

AND<br />

UPPER (firstname, 'EN_US') = 'JOHN'<br />

SELECT id<br />

FROM employee<br />

WHERE<br />

bonus + salary > 100000<br />

V9<br />

Indexes on expressions:<br />

CREATE INDEX upper_empname<br />

ON employee<br />

(UPPER (lastname, 'EN_US'),<br />

UPPER (firstname, 'EN_US'))<br />

CREATE INDEX total_compensation<br />

ON employee<br />

(salary + bonus)<br />

• Extra cost in Load, Insert, Update on<br />

key value, Rebuild Index, Check<br />

Index, <strong>and</strong> Reorg Tablespace, but not<br />

Reorg Index<br />

• Not eligible <strong>for</strong> zIIP offload<br />

• The rules <strong>for</strong> creating indexes on<br />

expression are more restrictive than<br />

<strong>for</strong> traditional indexes

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

Saved successfully!

Ooh no, something went wrong!