Isolation level for reading a row only once
Hi,
I need to select the first row from a table where a column value is equal to
false
and also modify it to true
. This means, if many request come at the same time (they do), no 2 SELECT statements should get the same row.
I am sure a distributed lock would solve the problem, but I was wondering if a transaction isolation level would be enough.
Would Serializable
isolation level be ideal for this use case?3 Replies
i would bet the combination of "many requests" and "using database for locking" wouldn't end well, but i could be wrong
Thanks, then I will go with a distributed lock
you can still benchmark it, especially if you can use an in-memory table