Answer the question
In order to leave comments, you need to log in
1) questions about locks 2) why is there no example of such a case in the description of isolation levels, which leads to data inconsistency?
Question 1 Here is the following table at the link src-code.net/koncepciya-blokirovok-v-sql-server :
Table 51.4. Isolation Levels and Lock
Duration Isolation Level - Total Lock Duration
Read Uncommited
Read Commited - Held while reading data
Explain what the difference would be between "None" and "Holded while reading data".
Question 2 https://ru.wikipedia.org/wiki/%D0%A3%D1%80%D0%BE%D...
Why, in the description of transaction isolation levels, only the problems of repeated reading of the SAME data (non-repeating read, phantom reading) are described, but they never write about artifacts that can occur when reading DIFFERENT (but interconnected) data at isolation levels below RepeatableRead? Here is an example (you can come up with an example with different tables, but here I will give an example with one table, but different rows that are interdependent):
There is a table of Users with the amounts of their accounts, i.e. the table has 2 columns - UserName and AmountSum. User1 has the amount of 10 rubles, User2 also has the amount of 10 rubles. User1 transfers to User2 5 rubles. The system opens a transaction of the ReadCommitted level, the following scripts are executed inside the transaction:
/*#time1*/Update Users
Set AmountSum = AmountSum + 5
Where UserName = 'Юзер2';
/*#time4*/Update Users
Set AmountSum = AmountSum - 5
Where UserName = 'Юзер1';
/*#time5*/
/*#time2*/Select *
From Users
Where UserName = 'Юзер1';
/*#time3*/Select *
From Users
Where UserName = 'Юзер2';
Answer the question
In order to leave comments, you need to log in
Question 1 Click hereAnd here is the SQL Server Transaction Row Locking and Versioning Guide . Better to read the original.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question