Overriding or Avoiding Locks

Page and row locking can be avoided at execution time by letting the system use lock avoidance mechanisms. DB2 can test to see if a row or page has committed data on it. If it does, then no lock at all is required on the data. Lock avoidance is valid only for read-only or ambiguous cursors, and requires a combination of events and settings to occur. First, the statement must be a read-only or an ambiguous cursor along with the proper isolation level and the appropriate CURRENTDATA setting. The best setting for the most lock avoidance is using an ISOLATION level of CS, either as a bind parameter or on the individual SQL statement, and CURRENTDATA set to NO as a bind option.

Lock avoidance is normally the default for ...

Get DB2® Universal Database for OS/390® Version 7.1 Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.