What are Concurrency Conflicts with regards to SQL database?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assume you have an SQL statement, e.g.,
UPDATE table SET a = a + 1 WHERE ..., which would correspond to the following code:Assume that two clients A and B execute this simultaneously. The following could happen (time flows from top to bottom):
What happens?
ais 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.