Transaction Processing

COMP9315 21T1 ♢ Transaction Processing ♢ [0/12]
❖ Transaction Processing

A transaction (tx) is ...


A transaction effects a state change on the DB

[Diagram:Pics/txproc/tx-exec1.png]

COMP9315 21T1 ♢ Transaction Processing ♢ [1/12]
❖ Transaction Processing (cont)

Transaction states:

[Diagram:Pics/txproc/tx-states1.png]

COMMIT all changes preserved,   ABORT database unchanged

COMP9315 21T1 ♢ Transaction Processing ♢ [2/12]
❖ Transaction Processing (cont)

Concurrent transactions are

To ensure problem-free concurrent transactions:
COMP9315 21T1 ♢ Transaction Processing ♢ [3/12]
❖ Transaction Processing (cont)

Transaction processing:


Consistency is the property: Ensuring this must be left to application programmers.


Our discussion focusses on: Atomicity, Durability, Isolation

COMP9315 21T1 ♢ Transaction Processing ♢ [4/12]
❖ Transaction Processing (cont)

Atomicity is handled by the commit and abort mechanisms

Durability is handled by implementing stable storage, via

Isolation is handled by concurrency control mechanisms
COMP9315 21T1 ♢ Transaction Processing ♢ [5/12]
❖ Transaction Processing (cont)

Where transaction processing fits in the DBMS:

[Diagram:Pics/txproc/dbmsarch.png]

COMP9315 21T1 ♢ Transaction Processing ♢ [6/12]
❖ Transaction Terminology

To describe transaction effects, we consider:

Relationship between the above operations and SQL:
COMP9315 21T1 ♢ Transaction Processing ♢ [7/12]
❖ Transaction Terminology (cont)

More on transactions and SQL

In PostgreSQL, tx's cannot be defined inside functions (e.g. PLpgSQL)
COMP9315 21T1 ♢ Transaction Processing ♢ [8/12]
❖ Transaction Terminology (cont)

The READ, WRITE, ABORT, COMMIT operations:

The operations are typically denoted as:

RT(X) read item X in transaction T
WT(X) write item X in transaction T
AT abort transaction T
CT commit transaction T

COMP9315 21T1 ♢ Transaction Processing ♢ [9/12]
❖ Schedules

A schedule gives the sequence of operations from ≥ 1 tx

Serial schedule for a set of tx's T1 .. Tn

E.g.   RT1(A)   WT1(A)   RT2(B)   RT2(A)   WT3(C)   WT3(B)  

Concurrent schedule for a set of tx's T1 .. Tn

E.g.   RT1(A)   RT2(B)   WT1(A)   WT3(C)   WT3(B)   RT2(A)  
COMP9315 21T1 ♢ Transaction Processing ♢ [10/12]
❖ Schedules (cont)

Serial schedules guarantee database consistency

Concurrent schedules interleave tx operations arbitrarily
COMP9315 21T1 ♢ Transaction Processing ♢ [11/12]
❖ Transaction Anomalies

What problems can occur with (uncontrolled) concurrent tx's?

The set of phenomena can be characterised broadly under:

COMP9315 21T1 ♢ Transaction Processing ♢ [12/12]


Produced: 11 Apr 2021