当存储过程在我们的 ASP.NET 页面之一上执行时,它在 SQL Server 上超时,但出现异常Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
。当我在 SSMS 中执行相同的存储过程时,它返回相对较快。 SQL Server 和 IIS 在同一个盒子上。我在两个地方都以同一用户身份登录。其他页面都很好。
可能是参数嗅探。
我的回答在这里 https://stackoverflow.com/questions/3478839/how-to-troubleshoot-sql-server-performance-problem/3479113#3479113为您提供了一些查询,您可以使用它们来检索两个执行计划(SSMS 和 ASP.NET )以进行比较和对比。
Edit
实际上这可能是一个更有用的查询。
Use YourDatabase;
SELECT *
FROM sys.dm_exec_cached_plans
CROSS APPLY sys.dm_exec_sql_text(plan_handle)
CROSS APPLY sys.dm_exec_query_plan(plan_handle)
cross APPLY sys.dm_exec_plan_attributes(plan_handle) AS epa
where sys.dm_exec_sql_text.OBJECTID=object_id('YourProcName')
and attribute='set_options'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)