HPlogo ALLBASE/SQL Reference Manual: HP 9000 Computer Systems

Chapter 5 Concurrency Control through Locks and Isolation Levels

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Table of Contents

Defining Transactions
Understanding ALLBASE/SQL Data Access
Use of Locking by Transactions
Basics of Locking
Locks and Queries
Costs of Locking
Defining Isolation Levels between Transactions
Repeatable Read (RR)
Cursor Stability (CS)
Read Committed (RC)
Read Uncommitted (RU)
Details of Locking
Lock Granularities
Types of Locks
Lock Compatibility
Weak Locks
What Determines Lock Types
Type of SQL Statement
Locking Structure Implicit at CREATE TABLE Time
Use of the LOCK TABLE Statement
Choice of a Scan Type
Choice of Isolation Level
Updatability of Cursors or Views
Use of Sorting
Scope and Duration of Locks
Examples of Obtaining and Releasing Locks
Simple Example of Concurrency Control through Locking
Sample Transactions Using Isolation Levels
Resolving Conflicts among Concurrent Transactions
Lock Waits
Deadlocks
Table Type and Deadlock
Table Size and Deadlock
Avoiding Deadlock
Undetectable Deadlock
Monitoring Locking with SQLMON
MONITOR Authority
Monitoring Tasks

Concurrency control is the process of regulating access to the same data by multiple transactions operating in the same DBEnvironment. Without regulation, a database could easily become inconsistent or corrupt. Consider what can happen if two or more concurrent users access the same data without any concurrency control. For example, one user could delete a row while another user is in the process of updating it. Or one user might update a row, and a second user might make a decision based on the update, then the first user might decide to roll back the update, at which point the second user's decision becomes invalid. To avoid problems of this type, it is important to regulate the kinds of access to database tables available to concurrent users.

This chapter describes the methods employed by ALLBASE/SQL to provide concurrency control for multiuser DBEnvironments. A section is devoted to each of the following topics:

  • Defining Transactions

  • Understanding ALLBASE/SQL Data Access

  • Use of Locking by Transactions

  • Details of Locking

  • What Determines Lock Types

  • Scope and Duration of Locks

  • Examples of Obtaining and Releasing Locks

  • Resolving Conflicts among Concurrent Transactions

  • Monitoring Locking with SQLMON

The techniques of concurrency control described in this chapter are normally implemented through application programs, though you can use some of them interactively as well.

Concurrency is a complex subject. If you are a new user of relational technology or of ALLBASE/SQL, you should read the entire chapter before attempting to use any of the special features described here.

Feedback to webmaster