Row level locking, new to DB2 in version 4.1, provides a finer level of locking granularity than the older options of LOCKSIZE PAGE and LOCKSIZE TABLESPACE.
With row level locking, multiple update programs can update data on the same data page.
Although it sounds like a wonderful feature, the benefits of row level locking are limited. If you have contention problems that row level locking will solve, then by all means give it a try. But if you aren't having contention problems, it makes no sense to use it. Our experience has been that the overhead of row level locking is noticeable but not as bad as some people claim. And modest additional CPU consumption is a small price to pay for the improved concurrency that row level locking offers in specific cases.
The table below shows the result of issuing various SQL statements against table DZ002.EMP after
this update has been issued (assuming that the update process holds its lock long enough to cause timeouts):
LOCKSIZE ROW | LOCKSIZE PAGE | LOCKSIZE TABLESPACE | |
SELECT LASTNAME FROM DZ002.EMP WHERE EMPNO = '900002' | Fail | Fail | Fail |
SELECT LASTNAME FROM DZ002.EMP WHERE EMPNO = '900002' WITH UR | OK | OK | OK |
SELECT LASTNAME FROM DZ002.EMP | Fail | Fail | Fail |
SELECT LASTNAME FROM DZ002.EMP WITH UR | OK | OK | OK |
SELECT LASTNAME FROM DZ002.EMP WHERE EMPNO = '900004' | OK | Fail | Fail |
©Copyright 1996 Chuck Anesi all rights reserved