What are Concurrency Conflicts?
concurrency
Solution
Assume you have an SQL statement, e.g., `UPDATE table SET a = a + 1 WHERE ...`, which would correspond to the following code:
read a
a = a + 1
write a
Assume that two clients A and B execute this simultaneously. The following could happen (time flows from top to bottom):
A B
read a
read a
a = a + 1
write a
a = a + 1
write a
What happens? `a` is incremented only once, although it should have been incremented twice. This is a classical concurrency conflict. To avoid such conflicts, databases use transactions and locks.
Problem
What are Concurrency Conflicts with regards to SQL database?