ALLBASE/SQL Reference Manual (36216-90216)

Chapter 5 187
Concurrency Control through Locks and Isolation Levels
What Determines Lock Types
the update corresponds to an index delete followed by an index insert. What should you
lock if there is no higher? Lock an imaginary tuple which has the highest possible key.
Note that locks are placed at the tuple level for PUBLICROW or at the page level for PUBLIC
tables.
Updatability of Cursors or Views
When a transaction uses cursors or views to access and manipulate data, the kinds of locks
obtained depend partly on whether the cursors or views are updatable according to the
rules presented under "Updatability of Queries" in Chapter 3 , “SQL Queries.” Table 5-3.
shows the locks obtained on updatable views and on updatable cursors declared FOR
UPDATE; they are listed in the "Read for Update" column in the table. In general, SIX, IX,
and X locks will not be used unless the query that underlies the view or cursor is
updatable.
Use of Sorting
If a query involves a sort operation, locks are maintained only if the transaction is at the
RR isolation level. When there is an ORDER BY,aGROUP BY, UNION,orDISTINCT clause in
a query, or if the optimizer decides to use the sort/merge join method for joins or nested
queries, the data in the tables is sorted and copied to a temporary table. The user's cursor
is really defined on this temporary table, which does not require any locking since it is
private to the user. Locks on the original tables underlying the view or cursor are retained
only if the transaction was started at the RR isolation level. Locks obtained at the CS or
RC level are released; locks are not obtained at all at the RU level.