3

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?

Community
  • 1
  • 1
Marco
  • 98
  • 1
  • 6

0 Answers0