I have a process with Select that takes a long time to complete, on the order of 5-10 minutes.
I am not currently using NOLOCK as a hint for the MS SQL database engine.
At the same time, we have another process that makes updates and inserts them into the same database and the same tables. the process began, recently ended prematurely message
SQLEXCEPTION: The transaction was blocked when resources were blocked by another process and was selected as the victim of the deadlock.
This first process runs on other sites under the same conditions, but with smaller databases, and therefore the selection request in question takes a much shorter amount of time (about 30 seconds or so). On these other sites, I do not receive a deadlock message on these other sites. I also did not receive this message on the site that had the problem initially, but I suppose, as the database grows, I suppose that I must have crossed some threshold. Here are my questions:
- Can the time required to complete a transaction make the associated process more likely to be flagged as a deadlock victim.
- If I made a selection using the NOLOCK hint, will this fix the problem?
- I suspect that the datetime field, which is checked as part of the WHERE clause in the select statement, causes a slow search time. Can I create an index based on this field? Is appropriate?
sql-server deadlock
Elliott Dec 05 '11 at 18:52 2011-12-05 18:52
source share