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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Static updatable cursor<br />

You can see that, <strong>for</strong> the static cursor model, the per<strong>for</strong>mance characteristics are the same as<br />

<strong>for</strong> the read programs. SENSITIVE FETCHes with the static cursor refer to the base table.<br />

Buffer pool I/O to the data in the base table occurs in each FETCH. The change of the<br />

number of UPDATEs or DELETEs does not impact per<strong>for</strong>mance much when you compare the<br />

first two cases, both building a temporary table of 1 million rows. In the second case, where<br />

the SQL activity is reduced by a factor of 100, the per<strong>for</strong>mance improvement is only 2.9% <strong>for</strong><br />

class 2 CPU time, and 4% <strong>for</strong> class 2 elapsed time. Additional CPU time in accounting is<br />

consumed by extracting the qualified rows and inserting them into the temporary table.<br />

On the other hand, when the size of the temporary table is drastically reduced, but keeping<br />

the SQL activity constant, you can see a significant per<strong>for</strong>mance improvement: A <strong>DB2</strong> class 2<br />

CPU time improvement of 88.5% and a <strong>DB2</strong> class 2 elapsed time improvement of 70%.<br />

Dynamic updatable cursor<br />

The same characteristics as dynamic read cursor apply <strong>for</strong> the dynamic update cursor model.<br />

When we compare Case 2 where we are only updating 10 rows and deleting 10 other rows<br />

and compare that with Case 1 where we are updating and deleting 1,000 rows each, the class<br />

2 <strong>DB2</strong> CPU time shows a 89% improvement and the class 2 <strong>DB2</strong> elapsed time exhibits a<br />

63.7% improvement. On the other hand, when we keep the SQL activity the same (Case 1 vs.<br />

Case 3) and vary the size of the result set, the class 2 <strong>DB2</strong> CPU time only shows a 3%<br />

per<strong>for</strong>mance improvement, and the class 2 <strong>DB2</strong> elapsed time (0.589 vs. 0.496) shows a<br />

15.7% improvement. Dynamic updatable cursor per<strong>for</strong>mance is greatly dependent on the<br />

amount of SQL activity.<br />

Comparing static updatable cursors to dynamic updatable cursors using class 2 <strong>DB2</strong> elapsed<br />

times <strong>for</strong> the metric, you see:<br />

► UPDATE or DELETE 1k, result set 1 million – 16.43 vs. 0.589 <strong>for</strong> 96% per<strong>for</strong>mance<br />

improvement<br />

► UPDATE or DELETE 10, result set 1 million – 15.75 vs. 0.215 <strong>for</strong> 99% per<strong>for</strong>mance<br />

improvement<br />

► UPDATE or DELETE 1k, result set 50k – 4.93 vs. 0.496 <strong>for</strong> 90% per<strong>for</strong>mance<br />

improvement<br />

Test scenario 3: Multi-row processing with scrollable cursors<br />

<strong>DB2</strong> V8 introduces multiple-row processing <strong>for</strong> both the FETCH and INSERT statements.<br />

Fetching multiple rows of data with one SQL statement can be done with both scrollable<br />

(static and dynamic) and non-scrollable cursors. This enhancement helps to lower the SQL<br />

statement execution cost by reducing the number of trips between the application and<br />

database engine, and in a distributed environment reducing the number of send and receive<br />

network messages as well.<br />

Since the same per<strong>for</strong>mance principles apply regarding the size of the temporary table in the<br />

static cursor model and the size of the result set in the dynamic model, regardless of the<br />

single fetch or multi-fetch implementation, we only consider a temporary table size of 1 M <strong>for</strong><br />

the static cursor model and a result set size of 1 M <strong>for</strong> the dynamic cursor model in the<br />

following two test cases.<br />

We have discussed multi-row per<strong>for</strong>mance in 3.1, “Multi-row FETCH, INSERT, cursor<br />

UPDATE and DELETE” on page 31. So in this chapter we only describe the per<strong>for</strong>mance of<br />

multi-row FETCH and INSERT used in conjunction with static and dynamic scrollable cursor.<br />

102 <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!