开发者

SQL Server view takes a long time to alter but query itself finishes quickly?

I am trying to alter an existing view in my SQL Server database. When I run the query by itself it finishes in about 4 seconds. When I run the alter s开发者_如何学编程tatement with the same query it runs and never finishes (waited 15 minutes before stopping it).

I do not have any indexes on the view I am trying to alter. Any ideas what would cause something like this to happen? Is there something I should be doing differently to speed things up?


Make sure there's no contention for that view. If something else is accessing it, or if there's a spid somewhere that's idle but has a connection to it, you may be blocked from the ALTER statement.

A simple sp_who2 active during the ALTER should give you the culprit.


I am too late for a response but I got the same issue. I just used kill (spid) for current query editor and then closed ssms and open it again and it is working fine for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜