DBMS - Transactions

MythiliMurugan3 42 views 14 slides May 20, 2021
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

Group of tasks


Slide Content

TRANSACTIONS “A group of tasks that form a single logical unit”

TRANSACTIONS Example: To withdraw 100 from an account – Operations: check the account balance If sufficient balance is present request for withdrawal. Get the money Calculate balance = Balance – 100 Update account with new balance

Transactions - Process Read Operation(READ(X)) To read a database object, it is first brought into main memory (Local Buffer) from disk(database), and then its value is copied into a program variable.

Transactions - Process Read Operation(READ(X))

Transactions - Process Write Operation (WRITE(X)) To write a database object, an in-memory copy of the object is first modified and then written to disk ( i.e ) Transfers the data item x from the local buffer to the transaction that executed the write back to the data base.

Transactions - Process Write Operation (WRITE(X))

ACID Properties Atomicity: each transaction must be considered as a single unit and must be completed fully or not completed at all. Database should be in a state either before the transaction execution or after the transaction execution.

ACID Properties Consistency: The database must remain in consistent state after performing any transaction.

ACID Properties Isolation: For every pair of transactions, one transaction should start execution only when the other finished execution.

ACID Properties Durability Once a transaction completes successfully, the changes it has made into the database should be permanent even if there is a system failure. If the system failure happens after customer getting the money then the system should be strong enough to update database with his new balance, after system recovers

Transaction - States

Transaction - States Active: insertion, deletion or updation of record is done here. But data is not saved to database Partially committed: when a transaction executed its final operation Failed: if any of the checks made by the database recovery system fails. A failed transaction can no longer proceed further.

Transaction - States Aborted: If a transaction is failed to execute, then the database recovery system will make sure that the database is in its previous consistent state. If not, it brings the database to consistent state by aborting or rolling back the transaction. Committed: If a transaction executes all its operations successfully.

Transaction - Example T1 T2 Read (A) Assume A=100 A=A+50 A=150 Write (A) Read (A) A=150 A=A+100 A=250 Rollback A=100 (restore back to original value which is before Transaction T1) Write (A)
Tags