TableB contains available tickets.
TableA contains used tickets (the actual requirement is more complex than this).
Each thread tries to get one available ticket from TableB (by using NOT EXISTS). However during high load, I found that more than 1 thread get the same ticket.
I thought INSERT ... SELECT would be treated as one atomic statement and should not cause the problem I am facing now. Probably, I missed some basic database concept here.
Thank you,
Main Topics
Browse All Topics





by: chapmandewPosted on 2008-06-24 at 11:10:24ID: 21858533
>>and found that more than 1 threads are able to insert the same record from TableB into TableA,
an isolation level isn't going to stop this....it is just going to make the other processes wait before they can insert their data. So, for your instance, why do you have different threads inserting the same data?