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.12.3 Per<strong>for</strong>mance<br />

To describe the difference between CURRENTDATA(NO) and CURRENTDATA(YES), let us<br />

give you an example:<br />

1. Program A, bound with ISOLATION(CS) CURRENTDATA(YES), fetches a row from a<br />

cursor. The row was read from the base table and not from a work file.<br />

2. Program B tries to update the row just read by Program A. The access is not allowed<br />

because the CURRENTDATA(YES) option <strong>for</strong> Program A caused a lock to be acquired on<br />

the page or the row.<br />

3. Program A issues a searched UPDATE of the row just fetched from step 1.<br />

In this example you see that CURRENTDATA protects the integrity of the data read by<br />

Program A between the fetch and the searched UPDATE.<br />

If Program A were to be bound with CURRENTDATA(NO) then Program B would be able to<br />

access the row just fetched by Program A (assuming correct timing and that lock avoidance<br />

worked). When Program A issues its searched UPDATE, it can wipe out the changes just<br />

made by Program B. So with the CURRENTDATA(NO) option, you must ensure the program<br />

has read intent only, otherwise <strong>DB2</strong> advantages of avoiding taking a lock to increase data<br />

concurrency can be offset by data integrity issues.<br />

Binding a plan or package with ISOLATION(CS) indicates that the data fetched by a cursor to<br />

be committed, but if the application process returns to the same page, another application<br />

might have since updated, deleted, or inserted qualifying rows. If the cursor is defined as<br />

FOR UPDATE OF, the data returned by the cursor is stable and it may not be updated by<br />

another transaction while the updateable cursor is positioned on it. If the cursor is defined as<br />

read-only (or is ambiguous), then isolation level CS ensures that the data returned is<br />

committed and the stability of the cursor is determined by the CURRENTDATA option.<br />

If the application is bound with ISOLATION(RR) or ISOLATION(RS), the updates of the table<br />

by other users are strictly restricted, you cannot acquire the advantage of using dynamic<br />

scrollable cursors, since a row or page lock is held <strong>for</strong> all accessed rows at least until the next<br />

commit point.<br />

Several measurements, using different types of programs, have been implemented. There are<br />

four scenarios. The first two cases deal with single-row processing. They compare static<br />

scrollable cursors and dynamic scrollable cursors <strong>for</strong> FETCH and UPDATE programs. The<br />

other two cases deal with multi-row processing. They compare single-row and multi-row<br />

processing when using static or dynamic scrollable cursors <strong>for</strong> FETCH and UPDATE<br />

programs.<br />

Hardware and software environment<br />

All the test cases use the following environment:<br />

► Hardware: <strong>IBM</strong> z900 Series 2064-216 (z900 turbo)<br />

– One LPAR with 2 dedicated processors<br />

– 7 GB real storage<br />

– Dedicated ESS model 800 (ESS)<br />

– 4 dedicated FICON channels<br />

► Software<br />

– z/<strong>OS</strong> V1.4<br />

– <strong>DB2</strong> V8<br />

– Non-data sharing<br />

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

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

Saved successfully!

Ooh no, something went wrong!