1

My understanding is that with SERIALIZABLE isolation level, I should not see any uncommitted data but my simple prototype output doesn't make sense to me. The initial value is "ready" and a second connection runs a transaction that sets the value to "set" WITHOUT committing. Then in the first connection I check the value and I see "set" which is an uncommitted value - not something I should see in SERIALIZABLE isolation level.

Connection 1:

set SESSION transaction isolation level SERIALIZABLE;
insert into test (name) values ('ready');

Connection 2:

SET autocommit = OFF;
set session transaction isolation level SERIALIZABLE;
start transaction;
update test set name = 'set' where id = 1;
-- THERE IS NO COMMIT HERE

Connection 1:

select * from test; -- shows the single row with 'set' as the value

Can someone explain why I'm seeing uncommitted values here? Is my understanding about isolation levels not correct or maybe is my script flawed?

Madhur Bhaiya
  • 28,155
  • 10
  • 49
  • 57
jbu
  • 15,831
  • 29
  • 82
  • 105

0 Answers0