GTU MCA MATERIAL FOR DBMS II

RSS
  • Home
  • Quick Review
  • Assignment
  • Backup and Recovery
  • Differences
  • About Me

Showing posts with label Uncommitted Data. Show all posts
Showing posts with label Uncommitted Data. Show all posts

Monday, March 21, 2011

Dirty Read Vs Unrepeatable Read


Dirty Read
Unrepeatable Read
A dirty read problem occurs when one transaction updates a database item and then the transaction fails for some reason.
Unrepeatable read occurs when a transaction calculate some aggregate (summary) function over a set of data while other transaction are updating the data.
This problem is also known as “Un-Committed Data”
This problem is known as “Inconsistent Analysis”
The dirty read is consequence of reading updates made by a transaction before it has successfully finished
In, databases Read-Write Conflict, also known as unrepeatable reads, is a computational anomaly associated with interleaved execution of transactions.
Example :

Connection A
Connection B
   ………
   ………
   ………
 UPDATE Row1
   ………
   ………
SELECT Row1
   ………
   ………
   ………
   ………
 ROLLBACK
Example :

Connection A
Connection B
SELECT SUM(accounts)
Acc[1]=40
Acc[1]=40 . . .  Sum = 40
Acc[2]=50
Acc[2]=50 . . .  Sum = 90
Acc[3]=30
            . . . . . .
  . . . . . .
            . . . . . .
UPDATE Acc3 = Acc3-10
            . . . . . .
(30 -> 20)
            . . . . . .
UPDATE Acc1= Acc1+10
            . . . . . .
(40 -> 50)
            . . . . . .
Commit
Acc[3]=20 . . . Sum = 110
(It Should be 120)

Situation :
Connection A reads an object that has been modified by Connection B but Connection B has not committed yet. Here, Connection B rollback transaction and uncommitted data is already read by Connection A.
This is known as “Dirty Read”
Situation :

Connection A performs aggregate sum of accounts, at same time Connection B modifies the database. This is resulted into Inconsistent Analysis
Problem : Transaction T2 was permitted to read the intermediate result of transaction T1 before the transaction T1 was terminated.

Problem of unrepeatable read occurs when a transaction reads a several values from database while other transaction updating those values.      

Solution : Prevent T2 from reading the account balance until the transaction T1 is terminated. i.e. either committed or rollback.

Solution is prevent other transaction to read the values from the database until one transaction release it.
Posted by Dr. Parag Shukla at 8:42:00 PM 0 comments
Email This BlogThis! Share to X Share to Facebook
Labels: Inconsistent Analysis, Read-Write Conflict, Uncommitted Data, Unrepeatble read
Older Posts Home
Subscribe to: Posts (Atom)

Total Pageviews

Blog Archive

  • ▼  2019 (1)
    • ▼  March (1)
      • Privacy Policy
  • ►  2016 (7)
    • ►  August (6)
    • ►  July (1)
  • ►  2011 (16)
    • ►  May (2)
    • ►  April (6)
    • ►  March (5)
    • ►  February (3)
  • ►  2010 (9)
    • ►  May (4)
    • ►  March (5)
  • ►  2009 (1)
    • ►  December (1)

Followers

Blog List

Search

Parag Shukla. Powered by Blogger.

Popular Posts

Copyright © 2010 GTU MCA MATERIAL FOR DBMS II