C
C#7mo ago
Core

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?
No description
3 Replies
Omnissiah
Omnissiah7mo ago
i would bet the combination of "many requests" and "using database for locking" wouldn't end well, but i could be wrong
Core
CoreOP7mo ago
Thanks, then I will go with a distributed lock
Omnissiah
Omnissiah7mo ago
you can still benchmark it, especially if you can use an in-memory table
Want results from more Discord servers?
Add your server