Query times out when executed from web, but super-fast when executed from SSMS

前端 未结 8 860
忘了有多久
忘了有多久 2020-11-27 02:57

I\'m trying to debug the source of a SQL timeout in a web application that I maintain. I have the source code of the C# code behind, so I know exactly what code is running.

8条回答
  •  余生分开走
    2020-11-27 03:49

    I've had this problem many times before but if you have a stored procedure with the same problem dropping and recreating the stored proc will solve the issue.

    It's called parameter sniffing. You need to always localize the parameters in the stored proc to avoid this issue in the future.

    I understand this might not be what the original poster wants but might help someone with the same issue.

提交回复
热议问题