Problem Everywhere.. Solution Everywhere..
If two or more transaction is accessing the same resource at same time. There is a problem of concurrency. Lets discuss what are the common problem arises in SQL Server.
1) Dirty Read
2) Lost Update
3) Non-repeatable Reads
4) Phantom Reads
1)Dirty Read – this problem is already discussed in the last posts.
Please follow at
2) Lost Update problem
To make it understand, we need to take one of the example.
- Lets John and Maria are working together on the school portal.
Both of them generated the all student report and found that one of the student age is in correct.
Currently,It is 17 years old in school record.
John, thinks it should be 14 instead of 17 and Maria thinks it should be 15 instead of 17.
Unfortunately, both of them started updating the record in the same Timestamp.
But, John takes more time to commit the record from age 17 to 14 as compared to Maria.
She commit the record from age 17 to 15 earlier than John.
Now, Maria wants to take the print of the currently updated record.
She found that lost the updated record of age, from 17 to 15.
this is the lost update problem in SQL server in concurrent transaction.
The (3) and (4) problem will be discussed in the next upcoming posts.