DB2 Concurrency Control




CS185c

Chris Pollett

Apr 27, 2010

Outline

Introduction

Concurrency Control

Phantom and Non-Repeatable Read Anomalies

Dirty Read and Lost Update Anomalies

Quiz

Which of the following statements is true?

  1. Type 3 JDBC drivers are written in pure Java.
  2. Authorization in DB2 is the process of establishing which primary and secondary IDs a user has.
  3. Roles and secondary IDs serve the same purpose in DB2.

Isolation Levels

Anomalies Seen at Various Isolation Levels

Picture summarizing the last slide showing the anomalies that can be seen at different

The PREP and BIND commands for application programs have a parameter that controls the isolation level for all transactions executed by the program that is being bound. The parameter consists of the word ISOLATION followed by the abbreviation of the desired level: RR, RS, CS, or UR. The default isolation level, both for application programs and for interactive sessions, is Cursor Stability (CS).

DB2 Locking Basics

Characteristics of Transaction Locking

Possible Lock Sizes

When a table space is created or altered, you can specify the LOCKSIZE option. The choices are:

Thoughts about Different Lock Sizes

Lock Mode

Lock Compatibility Table

held/requestedSUX
SYYN
UYNN
XNNN

Intent Locks

Types of Intent Locks.

The DB2 Locking Hierarchy

Compatibility of Lock Mode for Table

Intent lock compatibility chart

Duration of Page and Row Locks

Repeatable Read (RR)

Read Stability (RS)

Cursor Stability (CS)

Uncommitted Read (UR)

Lock escalation

Lock Suspensions and Timeouts

Deadlocks