ch14_transactions

ch14_transactions - Chapter 14: Transactions Chapter 14:...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 14: Transactions Chapter 14: Transactions
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
©Silberschatz, Korth and Sudarshan 14.2 Database System Concepts - 6 th Edition Chapter 14: Transactions Chapter 14: Transactions Transaction Concept Transaction State Concurrent Executions Serializability [skipping view serializability] Recoverability Implementation of Isolation Transaction Definition in SQL Testing for Serializability.
Background image of page 2
©Silberschatz, Korth and Sudarshan 14.3 Database System Concepts - 6 th Edition Transaction Concept Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various data items. E.g. transaction to transfer $50 from account A to account B: 1. read ( A ) 2. A := A – 50 3. write ( A ) 4. read ( B ) 5. B := B + 50 6. write ( B) Two main issues to deal with: Failures of various kinds, such as hardware failures and system crashes Concurrent execution of multiple transactions
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
©Silberschatz, Korth and Sudarshan 14.4 Database System Concepts - 6 th Edition Example of Fund Transfer Example of Fund Transfer Transaction to transfer $50 from account A to account B: 1. read ( A ) 2. A := A – 50 3. write ( A ) 4. read ( B ) 5. B := B + 50 6. write ( B) Atomicity requirement if the transaction fails after step 3 and before step 6, money will be “lost” leading to an inconsistent database state Failure could be due to software or hardware the system should ensure that updates of a partially executed transaction are not reflected in the database Durability requirement — once the user has been notified that the transaction has completed (i.e., the transfer of the $50 has taken place), the updates to the database by the transaction must persist even if there are software or hardware failures.
Background image of page 4
©Silberschatz, Korth and Sudarshan 14.5 Database System Concepts - 6 th Edition Example of Fund Transfer (Cont.) Example of Fund Transfer (Cont.) Transaction to transfer $50 from account A to account B: 1. read ( A ) 2. A := A – 50 3. write ( A ) 4. read ( B ) 5. B := B + 50 6. write ( B) Consistency requirement in above example: the sum of A and B is unchanged by the execution of the transaction In general, consistency requirements include Explicitly specified integrity constraints such as primary keys and foreign keys Implicit integrity constraints e.g. sum of balances of all accounts, minus sum of loan amounts must equal value of cash-in-hand A transaction must see a consistent database. During transaction execution the database may be temporarily inconsistent. When the transaction completes successfully the database must be consistent Erroneous transaction logic can lead to inconsistency
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
©Silberschatz, Korth and Sudarshan 14.6 Database System Concepts - 6 th Edition Example of Fund Transfer (Cont.) Example of Fund Transfer (Cont.) Isolation requirement — if between steps 3 and 6, another transaction T2 is allowed to access the partially updated database, it
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/10/2011 for the course CS 308 taught by Professor Frankl during the Spring '11 term at NYU Poly.

Page1 / 33

ch14_transactions - Chapter 14: Transactions Chapter 14:...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online