LearningCSharp
LearningCSharp

Reputation: 1302

What are Concurrency Conflicts?

What are Concurrency Conflicts with regards to SQL database?

Upvotes: 3

Views: 3425

Answers (3)

Heinzi
Heinzi

Reputation: 172230

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.

Upvotes: 6

Péter Török
Péter Török

Reputation: 116266

I believe that transaction isolation problems (e.g. non-repeatable read, phantom read, dirty read) are at least part of what you are looking for. See more e.g. here: http://en.wikipedia.org/wiki/Isolation_%28database_systems%29

Upvotes: 1

IordanTanev
IordanTanev

Reputation: 6240

Concurrency Conflicts occur when two transaction try to lock one resource at the database.There are many tutorials on this just use google to find some.Here is link to one link text

Upvotes: 0

Related Questions