SQL atomic increment and locking strategies – is this safe?
UPDATE query places an update lock on the pages or records it reads. When a decision is made whether to update the record, the lock is either lifted or promoted to the exclusive lock. This means that in this scenario: s1: read counter for image_id=15, get 0, store in temp1 s2: read counter for image_id=15, … Read more