0% found this document useful (0 votes)
31 views

Transactions and ACID Properties

Uploaded by

farzi kaam
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Transactions and ACID Properties

Uploaded by

farzi kaam
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Transactions and ACID

Properties
Kritin Potluru (IMT2020027)
What are Transactions?
 Group of tasks in DBMS
 Each “task” cannot be divided further
 Main issues to deal with:
 Failures of various kinds such as hardware failures, and system crashes
 Concurrent execution of multiple transactions
 Withdrawing money from an ATM machine
Operations in a Transaction

 Transaction Initiated  Read


 Insert ATM card  Write
 Select account  Commit
 Enter amount and pin
 Transaction process
 Collect cash and finish
Transaction States in a DBMS
Rollback
 Every operation is partially committed and stored in primary memory
 After commit, updated data/changes is/are stored in secondary memory
 Transaction reaches previous state if the system FAILS before COMMIT
 Disadvantages?
Properties of Transactions
 Every transaction must maintain ACID
 Ensures completeness, accuracy and integrity of data
 A : Atomicity
 C : Consistency
 I : Isolation
 D : Durability
Properties of Transactions: Atomicity

 Each transaction is an atomic unit


 Transactions do not occur partially
 Booking a ticket
 Paying for the ticket
 Reserving the seat
Properties of Transactions: Atomicity
 A has $30 available in his bank account and wants to send B $10
 B has $100 in his bank account and must receive $10
 Debit operation succeeds but credit operation fails
Properties of Transactions: Consistency
 Integrity of the
database must be
maintained
 Database must be
consistent before and
after the transaction
 Example:
 Total value of funds
between two
accounts must
remain same
 FK constraints
Properties of Transactions: Durability
 Any changes made by
transactions must be stored
 Changes must remain intact
even if a system failure occurs
 Non-volatile memory,
transaction log
Properties of Transactions: Isolation

 Multiple transactions can occur


concurrently without causing
inconsistencies
 Changes made are not visible to
other transactions without commits
 Prevent dirty reads through
concurrency control
 Locks
 Multiversion Concurrency Control
Isolation and Concurrency Control
Deadlocks
 T1 waits for T2 to give up the lock
 T2 waits for T1 to give up the lock
Schedules and Serializability
(Deadlock Avoidance)
 Instructions of one transaction
can interleave with other
transactions
 Schedules are series of
operations, one transaction
after the other
 They are of two types
 Serial Schedules
 Non – Serial Schedules
Serial vs Non-Serial Schedule
Transaction Management
 Most DBMS work with multiple tables, views etc.
 Transaction Management provides a framework for transactions
 Provides protocol on how to deal with issues
 Data Integrity
References

 https://people.inf.elte.hu/miiqaai/elektroModulatorDva.pdf
 https://link.springer.com/referenceworkentry/10.1007/978-1-4614-8265-9_8
35
 https://www.scaler.com/topics/dbms/transaction-in-dbms/
 https://byjus.com/gate/transaction-in-dbms-notes/#what-is-transaction-in-d
bms
 https://undraw.co
 https://www.geeksforgeeks.org/two-phase-locking-protocol/
Thank You!

You might also like