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.

3.10.1 Per<strong>for</strong>mance<br />

WHEN (NROW.EMPDPTID='010')<br />

BEGIN ATOMIC<br />

UPDATE USRT001.DEPTMENT<br />

SET DPTDPTSZ = DPTDPTSZ + 1<br />

WHERE DPTDPTID = NROW.EMPDPTID;<br />

END;<br />

The sample trigger used in the per<strong>for</strong>mance measurement has:<br />

► Name: ADD_AFT<br />

► Trigger activated: AFTER the operation<br />

► Operation starting the trigger: INSERT<br />

► Subject table name: USRT001.EMPLOYEE<br />

► New transition variable correlation name: NROW<br />

► Granularity: FOR EACH ROW<br />

► Trigger condition: WHEN (NROW.EMPDPTID='010')<br />

► Trigger body:<br />

BEGIN ATOMIC<br />

UPDATE USRT001.DEPTMENT<br />

SET DPTDPTSZ = DPTDPTSZ + 1<br />

WHERE DPTDPTID = NROW.EMPDPTID;<br />

END;<br />

For more details on triggers, see Chapter 12. Using triggers <strong>for</strong> active data in the manual <strong>DB2</strong><br />

<strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 Application Programming and SQL Guide, SC18-7415.<br />

Per<strong>for</strong>mance measurements were made in two cases:<br />

► 100 inserts activated trigger 100 times<br />

► 100 inserts activated trigger 100 times but WHEN condition evaluated to true only once<br />

The invocation of the triggers is via dynamic SQL. The triggers are static SQL.<br />

100 inserts activated trigger 100 times<br />

Figure 3-39 shows SQL and work file activity in V7 and V8 <strong>for</strong> the same SQL execution.<br />

Chapter 3. SQL per<strong>for</strong>mance 87

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

Saved successfully!

Ooh no, something went wrong!