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.

Alter Table Rotate Partition<br />

We executed and measured the following test cases (TC) on a 10 partition table space, a 50<br />

M row table, 1 PI and 0, 1, 3 NPIs:<br />

► TC1 - Delete all rows of partition 1 with SQL<br />

► TC2 - Alter table rotate partition<br />

► TC3 - Load replace with dummy input followed by alter table rotate partition<br />

See Figure 5-18 <strong>for</strong> the results of the measurements.<br />

Class 1 Elapsed Time<br />

(seconds)<br />

Rotate partition - Elapsed time comparison<br />

500<br />

400<br />

300<br />

200<br />

100<br />

0<br />

TC1 TC2 TC3<br />

1 PI, 0 NPI 1 PI, 1 NPI 1 PI, 3 NPIs<br />

TC1 = Delete Part 1 from Table<br />

TC2 = Alter Table Alter Part Rotate First To Last<br />

TC3 = 1. Load Replace Part 1 w/ Dummy Infile<br />

2. Alter Table Alter Part Rotate First To Last<br />

TC3 can be up to 100 times faster depending on the number of NPIs<br />

Figure 5-18 Rotate partition - Elapsed time comparison<br />

In TC1 we delete all the rows from partition 1. The slight difference with TC2 is due to <strong>DB2</strong><br />

predicate evaluation. Also ROTATE uses delete on part 1 but does not have to evaluate a<br />

predicate. If part 1 is emptied first by a dummy LOAD REPLACE elapsed time improves<br />

dramatically. NPIs must be scanned to delete the keys related to rows of part 1, the more<br />

NPIs defined the higher the impact on elapsed time.<br />

Conclusion<br />

Rotate will issue deletes <strong>for</strong> the partition to be reused. Consider the impact on logging and<br />

per<strong>for</strong>mance. A DBD lock will be held <strong>for</strong> the duration of the ROTATE.<br />

Recommendations<br />

In order to reduce the impact on logging and speed up the delete process consider first<br />

archiving the data in the affected partition and running a LOAD table PART n REPLACE with<br />

a dummy input. Be aware that ROTATE cannot be undone. Backup your data be<strong>for</strong>e rotating.<br />

Chapter 5. Availability and capacity enhancements 243

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

Saved successfully!

Ooh no, something went wrong!