Select Insert Deadlock

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bozzzza

    Select Insert Deadlock

    Lets say we select from TableA that joins to TableB

    TableB also gets data inserted into into it via another query.

    So I guess SQL server places a shared lock on Table A and Table B.
    and the insert will try and put an exclusive lock on the table.

    We then get a deadlock. What I am trying to get my head around is why?
    I would have thought that the Insert query would wait until the lock
    was released on table B. Ok the select query does take a long time,
    but I would have thought the insert would time out.

    I know there is something I am missing in my logic. I am just trying
    to figure out how the tables become deadlocked in this situation.

    TIA

Working...