Atomic increment of counter column using simple update
问题 I am trying to understand how to safely increment a counter column, that may be incremented simultaneously by many users (It's a Web API for a mobile app). I've read the popular questions in SO for strategies dealing with the issue but I can't seem to figure what's wrong with using a simple: UPDATE Table SET Counter = Counter + 1 I've built the following code sample to try and get inconsistent values and prove myself that using only this simple update statement is not good practice: class