The document discusses transactions and the ACID properties that ensure transaction integrity in a database management system (DBMS). It defines a transaction as a logical unit of work that can include operations like insert, delete, update, or retrieve data from a database. ACID properties - Atomicity, Consistency, Isolation, and Durability - guarantee that transactions are processed reliably and data integrity is maintained. It provides examples to illustrate how each ACID property functions and its importance for transaction processing.
2. Transaction Concept
A transaction is a collection of operations that form a single logical unit of work.
A transaction include insertion, deletion, modification, or retrieval, commit (to save the
data permanently in the data base), rollback (to undo the work done) operations to access
the data from the database.
The transaction can access database using following operations:
• READ(D) - It transfer the data item D from database to local memory of that transaction.
• WRITE(D) – It transfer the data item D from local memory of transaction to the database.
3. ACID Properties
As integrity is an integral part of database, to ensure integrity of database accessed
or updated by transaction, the database system maintain the following properties of
the transactions i.e. ACID properties.
A i.e. Atomicity
C i.e. Consistency
I i.e. Isolation
D i. e. Durability
4. • It refers to the ability of the DBMS to guarantee
that either all of the tasks of a transaction are
performed or none of them.
Atomicity
• It ensures that the database remains in a
consistent state before the start of the transaction
and after the transaction is over.
Consistency
• It means that the data used during the execution
of a transaction cannot be used by another
transaction until the first one is completed.
Isolation
• After the transaction successfully completes, the
transaction will persists and not be undone.
Durability
5. Atomicity
We have two accounts A and B , each containing Rs. 1000
We now start a transaction to deposit Rs. 100 from account A to Account B.
T1: READ (A)
A = A – 100
WRITE (A)
READ (B)
B = B + 100;
WRITE (B)
If transaction T1 fails after WRITE (A), then A is
with Rs. 900 and B has Rs. 1000, which does not
satisfy consistency criteria so Transaction
Management Component will roll back whole
transaction and will preserve database to original
state as A with Rs.1000 and B with Rs. 1000.
Atomicity is responsibility of Transaction Management
6. Consistency
We have two accounts A and B , each containing Rs. 1000
We now start a transaction to deposit Rs. 100 from account A to Account B.
T1: READ (A)
A = A – 100
WRITE (A)
READ (B)
B = B + 100;
WRITE (B)
Consistency criteria is to have sum of A and B i.e. A+B
should remain unchanged after execution of
transaction. It refers to the correctness of a database.
The total amount before and after the transaction must
be maintained.
Total before transaction occurs = 1000+1000= 2000
Total after transaction occurs = 900+1100= 2000
Consistency is responsibility of Application Programmer.
7. Isolation
Let A=1000 and B=1000 Consider two transactions T1 and T2.
T1: READ (A) T2: READ (A)
A = A+100 READ (B)
WRITE (A) C: = A + B
READ (B) WRITE (C)
B = B - 50;
WRITE (B)
Suppose T1 has been executed till Read (B) and then T2 starts.
As a result , interleaving of operations takes place due to
which T2 reads correct value of A but incorrect value of B and
sum computed by
T2 : (A+B = 1100+1000=2100)
is thus not consistent with the sum at end of transaction:
T1: (A+B = 1100 + 950 = 2050).
This results in database inconsistency, due to a loss of 50 units.
Hence, transactions must take place in isolation and changes
should be visible only after they have been made to the main
memory.
The Concurrency Control Component of database system ensures Isolation
8. Durability
This property ensures that once the transaction has completed execution, the updates
and modifications to the database are stored in and written to disk and they persist even
if a system failure occurs. These updates now become permanent and are stored in non-
volatile memory. The effects of the transaction, thus, are never lost.
Durability is responsibility of Recovery Management Component.
9. Transaction States in DBMS
A transaction can be in one of the following states while execution:
Active
Partially
committed
Failed
Committed
Aborted
Terminated
Read/Write
Operations
Failure
Failure
Permanent store
Roll Back
11. If you have a question, you can reach me via e-mail at omega.teched@gmail.com
Social Media Handles:
omega.teched
megha_with
megha-sharma24
OMega TechEd