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.

► More rows per one SQL statement (10 rows per multi-row statement results in significant<br />

improvement)<br />

► Fewer indexes processed in table<br />

Table 3-1 provides a summary of the measurements discussed <strong>for</strong> multi-row operations<br />

processing 100,000 rows in a non-partitioned table space with a 100,000 row table, 26<br />

columns, and 1 index.<br />

Table 3-1 Class 1 CPU time (sec.) to process 100,000 rows<br />

Type of MR operation<br />

loopsxrows per SQL<br />

In general, <strong>for</strong> single-row processing <strong>DB2</strong> V8 uses more CPU time, with the exception of the<br />

insert operation.<br />

3.1.6 Recommendation<br />

Explicit multi-row FETCH, INSERT, cursor UPDATE, and cursor DELETE in local<br />

environments can improve per<strong>for</strong>mance with a reduction of CPU time (between 25% and 40%<br />

in the measurements processing 10 rows per SQL statement) if a program processes a<br />

considerable number of rows. Depending on each particular case, a number between 10 rows<br />

and 100 rows per SQL can be a good starting point <strong>for</strong> multi-row operations.<br />

This option requires definition of host variable array declaration of the cursor with rowset<br />

positioning and the text of the SQL to specify the rowset size.<br />

You also have to change your coding on how to do cursor processing. You have to look at how<br />

many rows are returned on a FETCH via SQERRD3 flag in the SQLCA (or the equivalent<br />

ROW_COUNT when using GET DIAGN<strong>OS</strong>TICS).<br />

For existing programs it is worth evaluating the benefits provided vs. the cost of recoding the<br />

programs. The extra storage needed <strong>for</strong> multi-row operations is allocated in the allied address<br />

space, or stored procedure, or DDF.<br />

A variable array has to be explicitly declared. Example 3-2, extracted from the <strong>DB2</strong><br />

Application Programming and SQL Guide, SC18-7415, shows declarations of a fixed-length<br />

character array and a varying-length character array in COBOL.<br />

Example 3-2 COBOL array declaration<br />

01 OUTPUT-VARS.<br />

05 NAME OCCURS 10 TIMES.<br />

49 NAME-LEN PIC S9(4) COMP-4 SYNC.<br />

49 NAME-DATA PIC X(40).<br />

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

FETCH INSERT FETCH/UPDATE FETCH/DELETE<br />

V7 single-row 1.09 2.92 2.5 3.68<br />

V8 single-row 1.15 2.73 2.79 3.81<br />

50kx2 1.02 2.51 2.8 3.71<br />

10kx10 0.64 1.94 1.88 2.76<br />

1kx100 0.55 1.8 1.57 2.42<br />

100x1k 0.54 1.79 1.51 2.37<br />

10x10k 0.54 1.79 1.51 2.35

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

Saved successfully!

Ooh no, something went wrong!