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.5 Conclusion<br />

Multi-row FETCH and UPDATE or DELETE with a dynamic cursor<br />

We now apply the multi-row update and delete function to the updatable programs in the<br />

dynamic cursor model. The results are shown in Table 3-9. They show a 17.8% per<strong>for</strong>mance<br />

improvement in <strong>DB2</strong> class 2 CPU time (0.135 vs. 0.111) and a 7% per<strong>for</strong>mance improvement<br />

in <strong>DB2</strong> class 2 elapsed time (0.589 vs. 0.547).<br />

Table 3-9 Multi-row FETCH and UPDATE or DELETE dynamic<br />

Multi-row update and delete with the dynamic cursor model result in significant per<strong>for</strong>mance<br />

improvements over the static cursor model, but the multi-row fetch <strong>for</strong> update programs does<br />

not improve as dramatically as the multi-row fetch <strong>for</strong> read-only programs. Compare them to<br />

Table 3-7 on page 104. This is because with the read-only programs <strong>for</strong> multi-row fetch the<br />

bulk of the <strong>DB2</strong> CPU time is the reduction of the number of trips between the application and<br />

database engine, which has been reduced by a factor of 100 (fetching 100 rows 500 times vs.<br />

50,000 individual fetches). When we apply multi-row fetch to the update program, the <strong>DB2</strong><br />

CPU and elapsed times are not only accounting <strong>for</strong> the reduced number of trips between the<br />

application and database engine <strong>for</strong> the fetches, but also the update (1,000 rows per<strong>for</strong>med<br />

25 rows at a time) and delete (1,000 rows also per<strong>for</strong>med 25 rows at a time) activity. The<br />

update and delete activity is per<strong>for</strong>med on a rowset basis rather than individually, but it is a<br />

significant consumer of CPU cycles due to its complexity.<br />

For equivalent function, the dynamic cursor model generally outper<strong>for</strong>ms the static cursor<br />

model. The per<strong>for</strong>mance overhead to build the temporary table with static cursors is the<br />

largest contributor of CPU overhead. For the dynamic cursor model, since all accesses are<br />

per<strong>for</strong>med on the base table, the amount of SQL activity (from a <strong>DB2</strong> class 2 perspective)<br />

becomes the deciding factor.<br />

When multi-row processing is applied to static cursors (whether read or updatable), since the<br />

temporary table is built row-by-row, regardless of the fetch implementation, this new feature<br />

with <strong>DB2</strong> V8 does not contribute significantly, at least with this amount of DML activity. But <strong>for</strong><br />

dynamic read cursors, multi-row fetch shows per<strong>for</strong>mance gains of 50% <strong>for</strong> both <strong>DB2</strong> class 2<br />

CPU and elapsed times over the single fetch equivalent program. While the dynamic<br />

multi-row fetch and cursor update and delete program show significant improvement over its<br />

single fetch, update and delete equivalent program (17.8% improvement in <strong>DB2</strong> class 2 CPU<br />

time), it is not as high as just the multi-row fetch program due to the intrinsically more complex<br />

and costly functions of multi-row update and multi-row delete. In addition, the row set size <strong>for</strong><br />

the read-only multi-row fetch program was bigger (100 vs. 25) and resulted in less interaction<br />

between the application and database engine.<br />

3.12.6 Recommendations<br />

With a static cursor, class 3 time is heavily dependent on the size of the temporary table <strong>for</strong><br />

both read and updates. So it is important <strong>for</strong> the per<strong>for</strong>mance of a static scrollable cursor to<br />

106 <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 />

Dynamic single row<br />

UPDATE or<br />

DELETE 1k each<br />

Open 1M<br />

Class 1 ET / CPU 0.601 / 0.148 0.582 / 0.115<br />

Class 2 ET / CPU 0.589 / 0.135 0.547 / 0.111<br />

Class 3 suspend 0.454 0.433<br />

Dynamic multi-row<br />

UPDATE or DELETE 25 rows<br />

x 40 times each<br />

Open 1M

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

Saved successfully!

Ooh no, something went wrong!