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

Update 10 rows using a positioned Multi-row FETCH/UPDATE<br />

on a rowset cursor<br />

EXEC SQL<br />

UPDATE TABLE1<br />

SET COL3=COL3+1<br />

WHERE CURRENT OF C1;<br />

Delete 10 rows using a positioned Multi-row FETCH/DELETE<br />

EXEC SQL<br />

DELETE FROM TABLE1<br />

WHERE CURRENT OF C1;<br />

Figure 3-3 Example of multi-row cursor update and delete<br />

To update in SQL, if only the nth row in the rowset instead of the whole rowset needs to be<br />

updated, which might be more common, you specify ‘FOR ROW n OF ROWSET’, as shown<br />

here:<br />

EXEC SQL<br />

UPDATE TABLE1<br />

SET COL3=COL3+1<br />

WHERE CURRENT OF C1 FOR ROW n OF ROWSET;<br />

All constraint checks are effectively made at the end of the statement. In the case of a<br />

multi-row update, this validation occurs after all the rows are updated. The only place it can be<br />

different is in AFTER UPDATE FOR EACH ROW triggers that have an external action. In all<br />

other cases, the whole UPDATE is an atomic operation. Either all changes are made or no<br />

changes are made.<br />

In this section we discuss the environment and measurements related to multi-row operations<br />

when executed locally.<br />

Per<strong>for</strong>mance measurement scenario<br />

► Configuration<br />

– <strong>DB2</strong> <strong>for</strong> z/<strong>OS</strong> V8 and V7<br />

– z/<strong>OS</strong> Release 1.4.0<br />

– 2-way processors 2084 z990<br />

– ESS 800 DASD with FICON® channels<br />

– Non-data sharing<br />

► Non-partitioned table space, 100,000 rows table, 26 columns, 1 index<br />

34 <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>

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

Saved successfully!

Ooh no, something went wrong!