New answers tagged


Deadlocks are not caused by a particular statement. It is caused by concurrency issues. So basically, you should start observing how one session of your application deal with from other sessions working concurrently. Here is a general guideline for avoiding deadlocks: Always maintain primary keys on tables. This primary key should be the means to identify ...


I will write the solution here for those who might encounter such error in the future. I solved the error by re-compiling invalid objects.


Many of the issues you see are being caused by an inefficient execution plan: Not that the supplied plan and query matches the question, but even so, I'm working with what was provided. Anyway, you should implement the Name column data type changes (from nvarchar(max)) that I mentioned in your previous question. More importantly, you need to add the ...


Can some or all of the 4 steps be replaced by a single query: INSERT ... ON DUPLICATE KEY UPDATE ... or maybe INSERT IGNORE ... and check rows_affected? It would be better if you showed us all the SQL between BEGIN and COMMIT. Are you doing any time-consuming processing between BEGIN and COMMIT? Can any of it be moved out. The faster the transaction ...

Top 50 recent answers are included