Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Deadlocks: What locks are obtained for an update

$
0
0

Hi all,

I'm currently investigating a deadlock & I'm not understanding why my update statement on table x is holding an exclusive lock on table y.

I'm guessing it is because table x has a foreign key to table y, and because the applications data access layer updates every column in table x whenever an update occurs i.e. while the foreign key column of table x does not need to be updated, it is, because it appears that's the way the app performs all updates!

Before I request this to be changed - I want to make sure my guess is correct. If someone could please confirm/correct:

1. a. An update statement on table x can take exclusivelocks on any tables referenced by table x

b. If a foreign key column is not included in the update statement, the update statement will not take any lock on the referenced table

Thanks for reading.

Clay.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>