Concurrency control in ALLBASE/SQL operates at the level of
the transaction, which identifies an individual user's unit of work
within a multiuser DBEnvironment. As mentioned in a previous chapter,
transactions are bounded by BEGIN WORK and COMMIT WORK
statements. If you omit the BEGIN WORK statement, ALLBASE/SQL issues
one automatically, using
the RR (repeatable read) isolation level. ALLBASE/SQL keeps track of
which transactions are accessing which pages of data at a particular
moment in time. Transactions have unique ID numbers which are listed
in the SYSTEM.TRANSACTION pseudotable in the system catalog.
Transactions can be seen as taking place over time, as in
Figure 5-1 Transactions over Time.
Figure 5-1 Transactions over Time
In this example, transaction 2 begins before transaction 1
ends; therefore, transaction 1 and transaction 2 are concurrent
transactions. Transaction 3 begins after transaction 1 has committed;
therefore, transaction 1 and transaction 3 are not concurrent, since
they do not occupy the same time.
Concurrent transactions that need to access the same data
pages may be in contention for a particular table, page, or row
at a particular moment. Suppose transaction 1 needs to access an
entire table as part of a reporting application. If transaction
2 needs to update parts of that table, it may need to wait until
transaction 1 is complete before the update can proceed.
Chapter 5 Concurrency Control through Locks and Isolation Levels