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.7.2 Conclusions<br />

Example 3-9 Multiple table ORDER BY sort query<br />

SELECT C_CUSTKEY, C_NAME,<br />

O_ORDERKEY AS REVENUE,<br />

C_ACCTBAL, C_NAME, C_ADDRESS, C_PHONE, C_COMMENT<br />

FROM CUSTOMER, ORDER<br />

WHERE C_MKTSEGMENT = 'BUILDING'<br />

AND C_CUSTKEY = O_CUSTKEY<br />

AND O_ORDERDATE < DATE('1994-12-05')<br />

ORDER BY C_CUSTKEY, C_NAME,<br />

REVENUE,<br />

C_ACCTBAL, C_NAME, C_ADDRESS, C_PHONE, C_COMMENT<br />

Figure 3-36 shows the per<strong>for</strong>mance improvements <strong>for</strong> ORDER BY due to parallel sort.<br />

Multiple table ORDER BY sort<br />

Figure 3-36 Multiple table order by sort<br />

We observe in the example of ORDER BY the best situation is when we fetch the first 10 rows<br />

(reduction of 81% in elapsed time) when V8 is compared to V7. In this case there is also a<br />

significant reduction in the number of getpages <strong>for</strong> work files. No merge is needed because<br />

the rows are already in the right sequence.<br />

Parallel sort can improve the elapsed time of long running queries when parallelism is used<br />

as summarized in the following list:<br />

► Up to 6x elapsed time improvement observed with no merge pass<br />

► Typical queries have less improvement due to merge pass<br />

► May need bigger work file buffer pool size<br />

► May need to allocate more work files or use parallel access volume (PAV)<br />

► Work file getpage may increase when query has two or more parallel sort composites<br />

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

ORDER BY sort of 4M rows<br />

nested loop join of 2 tables, 1 parallel group, DEGREE(30)<br />

merge pass not needed <strong>for</strong> V8, rows already in order by sequence<br />

up to 4.7X reduction in elapsed time<br />

up to 3X reduction in workfile activities<br />

Fetch first 10<br />

Elapsed<br />

rows<br />

secs<br />

CPU<br />

secs<br />

Workfile<br />

getpages<br />

Fetch all rows Elapsed<br />

secs<br />

CPU<br />

secs<br />

Workfile<br />

getpages<br />

V7<br />

Seq Sort<br />

V8<br />

Parallel<br />

Sort<br />

Delta<br />

216 42 -81%<br />

88 74 -16%<br />

1221204 406994 -67%<br />

682 535 -22%<br />

550 557 +1%<br />

1627864 813712 -50%

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

Saved successfully!

Ooh no, something went wrong!