Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home
Jazz home  >  Papers & Training

IMAGE/SQL: Issues and answers concerning SQL tables

» 

Jazz home

»

Software

»

Papers & Training

»

Java

»

HP Partners

»

News & Events

»

Register for more info

Content starts here
Prev Page Next Page Manual Top Home Page


5.17 What is intention locking?




NOTE: the shading on this picture may not be accurate. Please click on the picture to obtain a larger image, which is accurate.

Key points


  • Intention locks reduce the number of locks that must be examined when a new lock is allocated. Intention locks allow transactions to quickly determine if rows (or pages) in a given table have been locked by other transactions. Without the use of intention locks, ALLBASE/SQL would have to search all row (or page) locks on a table to determine whether or not a new lock request could be granted. Such searching would be very inefficient, especially on large tables.

  • When a lock is acquired at a smaller granularity, an intention lock is first acquired at a larger granularity.

    • When a row lock is acquired on a PUBLICROW table, the following occurs:

      • An intention lock is acquired on the table.

      • After the table lock has been granted, an intention lock is acquired on the page.

      • After the page lock has been granted, the row lock is acquired.

    • When a page lock is acquired on a PUBLIC table, the following occurs:

      • An intention lock is acquired on the table.

      • After the table lock has been granted, the page lock is acquired.

  • When two locks are compatible, both access requests are allowed to the data object (that is, the table, page or row) at the same time. When compatible locks exist on a data object, ALLBASE/SQL computes which lock is strongest and stores this information. When locks are not compatible, the second access request must wait until the lock acquired by the first access request is released.

  • Any request for a lock at the table level is compared to the strongest lock on the table. If the table has already been locked in an incompatible mode by another transaction, the transaction that is requesting the lock will wait until the lock can be granted (or a timeout occurs). Next, a request for a page lock is made. If this page has been locked in an incompatible mode by another transaction, the requesting transaction will wait until the lock can be granted (or a timeout occurs). Finally, if row level locking is used, the request for a row lock is made.

  • A transaction timeout will only occur if the wait for a single database resource consumes an amount of time equal to the timeout limit. If a transaction's timeout limit is set to 10 seconds, and it takes a 5 second wait to obtain an intention lock on the table and a 6 second wait to obtain a lock on a page, the transaction will not timeout. If either wait consumed 10 seconds, then a timeout would occur.

  • Intention locks are only acquired on PUBLICROW and PUBLIC tables. Remember that PUBLICROW tables use row level locking, and PUBLIC tables use page level locking.

  • PRIVATE and PUBLICREAD tables use table level locking, so intention locks are not needed by ALLBASE/SQL.

  • The three types of intention locks are INTENT SHARE (IS), INTENT EXCLUSIVE (IX), and SHARE and INTENT EXCLUSIVE (SIX).


Prev Page Next Page Manual Top Home Page

Page last updated on November 29, 1995

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2004 Hewlett-Packard Development Company, L.P.