How to debug a SQL Server table insertion that hangs?

时间:2017-06-04 23:41:12

标签: sql tsql sql-server-2012

On my SQL Server, I have a query which does not produce any rows and this select statement runs for about a minute. Now I don't understand why the insert would not finish forever. The destination table has only 48k rows. I don't have rights to run any kinds of tracing or any other diagnostic queries that can help this. What else can I try?

1 个答案:

答案 0 :(得分:0)

将插入物转换为选择,以便您可以看到要插入的内容。然后从SQL语句(连接,子查询等)中取出部分,直到它开始快速运行。你删除的最后一件事是缓慢的原因。如果没有示例,我们无法为您提供更具体的帮助。编写https://stackoverflow.com/help/mcve的过程可能会帮助您自己回答。