Docsity

Transaction Processing Concepts - Data Base Management System - Lecture Slides, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Transaction Processing Concepts - Data Base Management System - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Transaction Processing Concepts

Introduction to Transaction

Processing

  • Single-User Vs. Multi-User Systems
  • Read and Write Operations of a Transaction
  • Problems in Concurrency Operations
  • Types of Transaction Failures
  • Serializability of Schedules

Objectives

  • Function and importance of transactions.
  • Properties of transactions.
  • Concurrency Control
    • Meaning of serializability.
    • How locking can ensure serializability.
    • Deadlock and how it can be resolved.
    • How timestamping can ensure serializability.
    • Optimistic concurrency control.
    • Granularity of locking.
  • Recovery Control
    • Some causes of database failure.
    • Purpose of transaction log file.
    • Purpose of checkpointing.
    • How to recover following database failure.
  • Alternative models for long duration

transactions.

Transaction Support

  • A transaction is a sequence of one or more SQL operations treated as a unit ( another working definition).
  • SQL standard (and Oracle):
  • Transaction begins automatically when first SQL command is issued.
  • Transaction ends (and new one begins) when "COMMIT" command is issued or session ends.
  • Alternative "AUTO COMMIT" mode turns each statement into a transaction.

Example Transaction

Transaction Support

  • Can have one of two outcomes:
    • Success - transaction commits and database reaches a new consistent state.
    • Failure - transaction aborts , and database must be restored to consistent state before it started.
    • Such a transaction is rolled back or undone.
  • Committed transaction cannot be aborted.
  • Aborted transaction that is rolled back can

be restarted later.

State Transition Diagram for Transaction

Properties of Transactions

Consistency Must transform database from

one consistent state to another.

Implemented by database integrity constraints.

Properties of Transactions

Isolation Partial effects of incomplete transactions

should not be visible to other transactions.

Implemented by locking

  • Two transactions can be executed in perfect isolation if they run serially
  • However, running transactions strictly serially results in low throughput and poor response time
  • To improve efficiency, transactions can be interleaved. This is called concurrency.
  • The operations of one transaction can be freely interleaved with another so long as they do not conflict( operate on the same data)
  • Transaction can run concurrently

DBMS Transaction Subsystem

DBMS Transaction Subsystem

Concurrency Example

  • Database consisting of two items, X and Y
  • Only criterion for correctness: X=Y
  • Two concurrent transactions

T1: X X+1 T2: X 2*X

Y Y+1 Y 2*Y

Initially, X=10 and Y=

Need for Concurrency Control

  • Three examples of potential problems

caused by concurrency( transaction conflict

scenarios)

  • Lost update problem (Dirty Write)
  • Uncommitted dependency problem ( Dirty Read)
  • Inconsistent analysis problem ( Fuzzy Read).