Contents IndexIsolation levels and consistency Choosing an isolation level

User's Guide
   Part III. Using SQL Anywhere
     Chapter 19. Using Transactions and Locks
      How SQL Anywhere handles locking conflicts

When a transaction attempts to acquire a lock on a row, but is forbidden by a lock held by another transaction, a locking conflict arises and the transaction attempting to acquire the lock is blocked. The section "Locking conflicts and transaction blocking" describes how SQL Anywhere handles transaction blocking.

"Transaction blocking and deadlock" describes how SQL Anywhere handles a deadlock when transactions cannot become unblocked.

Top of page


Locking conflicts and transaction blocking

When a locking conflict occurs, one transaction must wait for another transaction to complete. A transaction becomes blocked on another transaction. If two transactions simultaneously have a read lock on a row, the behavior when one of them attempts to modify that row (acquire a write lock) depends on the database setting BLOCKING.

Blocking is more likely to occur with higher isolation levels because more locking and more checking is done. Higher isolation levels provide less concurrency.

For information about the BLOCKING option, see "SET OPTION statement".

Top of page


Transaction blocking and deadlock

Transaction blocking can lead to deadlock, where a set of transactions get into a state where none of them can proceed.

Reasons for deadlocks

A deadlock can arise for two reasons:

SQL Anywhere automatically cancels the last transaction that became blocked (eliminating the deadlock situation), and returns an error to that transaction indicating which form of deadlock occurred.

Top of page


Contents IndexIsolation levels and consistency Choosing an isolation level