· 11 min read
Concurrency Belongs at the Write, Not at the Read
Under ordinary database isolation levels two concurrent requests can both read the same available balance, both find it sufficient, and both commit, leaving the balance negative. Checking availability before the write cannot prevent it, because the check and the write are separate decisions taken against a stale view. Enforce the constraint where the write lands: a uniqueness constraint, a conditional update, or explicit locking.