Difference between ReadCommitted and Repeatable Read isolation level in Update

Question

These days I improved my knowledge about Isolation Level of transactions.

In particular, i had problem to understand well the difference between Read Committed and Repeatable Read.

I've read this fantastic article, and I understand all about dirty-reads, non-repeatable read and phantoms read but i don't understand what happen with multiple transactions in update.

Example:
Table: "Test" (Field: ID_REC - Data)
Transaction A:

set transaction isolation level read committed;
begin transaction

update test
set DATA = 't1'
where ID_REC = 1

waitfor delay '00:00:20'
commit transaction

Transaction B: (the same but with another record)

set transaction isolation level read committed;
begin transaction

update test
set DATA = 't2'
where ID_REC = 2

commit transaction

I execute both transactions in two seconds. Second transaction doesn't start until first one is finished. And also i can't execute query (select * from test).

So: why happen this? Transactions works on different rows... and about this case, what is the difference between Read Committed and Repeatable Read?


Show source
| sql-server   | sql   2017-01-02 08:01 1 Answers

Answers ( 1 )

  1. 2017-01-02 09:01
◀ Go back