
















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















































Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe
1 Introduction to Transaction
Processing (1)
n Concurrent execution of processes is interleaved in a single CPU
n Processes are concurrently executed in multiple CPUs.
n A Transaction :
n Logical unit of database processing that includes one or more access operations (read -retrieval, write - insert or update, delete).
n A transaction (set of operations) may be stand-alone specified in a high level language like SQL submitted interactively, or may be embedded within a program.
n Transaction boundaries :
n Begin and End transaction.
n An application program may contain several transactions separated by the Begin and End transaction boundaries.
n Basic unit of data transfer from the disk to the computer main memory is one block. In general, a data item (what is read or written) will be the field of some record in the database, although it may be a larger unit such as a record or even a whole block.
n read_item(X) command includes the following steps:
n Find the address of the disk block that contains item X. n Copy that disk block into a buffer in main memory (if that disk block is not already in some main memory buffer). n Copy item X from the buffer to the program variable named X.
READ AND WRITE OPERATIONS (contd.):
n write_item(X ) command includes the following steps:
n Find the address of the disk block that contains item X. n Copy that disk block into a buffer in main memory (if that disk block is not already in some main memory buffer). n Copy item X from the program variable named X into its correct location in the buffer. n Store the updated block from the buffer back to disk (either immediately or at some later point in time).
Why Concurrency Control is needed: n The Lost Update Problem n This occurs when two transactions that access the same database items have their operations interleaved in a way that makes the value of some database item incorrect. n The Temporary Update (or Dirty Read) Problem n This occurs when one transaction updates a database item and then the transaction fails for some reason (see Section 17.1.4). n The updated item is accessed by another transaction before it is changed back to its original value. n The Incorrect Summary Problem n If one transaction is calculating an aggregate summary function on a number of records while other transactions are updating some of these records, the aggregate function may calculate some values before they are updated and others after they are updated.
Concurrent execution is uncontrolled:
(a) The lost update problem.
Concurrent execution is uncontrolled:
(c) The incorrect summary problem.
Introduction to Transaction
Processing (12)
Why recovery is needed:
(What causes a Transaction to fail)
Introduction to Transaction
Processing (14)