我有两台运行相同SQL查询的服务器。查询在一台服务器上正常运行,但在其他服务器上运行时间太长(37秒)。
我打开了统计数据,我得到了这些结果:
服务器1(此工作正常,结果在2秒内返回):
SQL Server parse and compile time:
CPU time = 193 ms, elapsed time = 193 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
Jan 30 2014 10:24PM
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
Feb 6 2014 10:24PM
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
(6 row(s) affected)
SQL Server Execution Times:
CPU time = 172 ms, elapsed time = 182 ms.
服务器2 :(这需要37秒)
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
Jan 30 2014 10:24PM
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
Feb 6 2014 10:24PM
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
(6 row(s) affected)
SQL Server Execution Times:
CPU time = 34255 ms, elapsed time = 34087 ms.
正如您所看到的那样,问题是渲染查询,出于某些原因,当我从SSRS报告中调用查询时,它会做同样的事情。该报告立即在服务器1上呈现,但在服务器2上永远呈现。
有人可以指出我的方向是正确的吗?
答案 0 :(得分:1)
请根据您的两台服务器仔细检查并观察这些点,并相互检查:
我可能的深度分析的首选文档用作概述: http://sqlserverplanet.com/troubleshooting/sql-server-slowness
您还可以在这里查看: How to analyze 'dbcc memorystatus' result in SQL Server 2008
否则,你可以在mssqltips dot com上搜索有关如何识别sql server memory / cpu瓶颈的信息(因为我不允许发布更多链接)。他们也有很好的文件。
希望这会对你有所帮助。