相同SQL查询的执行时间不同 [英] Different Execution time for Same SQL Query
问题描述
您好,
我在SQL Management Studio中执行我的计算机上的存储过程,而数据库位于另一台计算机上(只是具有3GB RAM的普通计算机) ,而不是服务器)
存储过程正常工作,但每次执行时间都不同,即使所有参数都相同。执行时间从1分钟到8分钟不等。我无法找到原因并且我之间没有使用任何DBCC命令。
虽然我知道服务器的内存/ CPU可用性在这里起作用,我仍然无法理解原因。
请分享您的想法
谢谢
Hello,
I am executing a stored procedure on my machine in SQL Management studio and database is located on another machine(just ans ordinary machine which has 3GB RAM, not a server)
Stored procedure works properly, but every time it takes different time to execute even if all parameters are the same. Execution time varies from 1 minutes to 8 minute. I am not able to find reason for this and i am not using any DBCC command in between.
Though i understand that memory/CPU availability of server plays a role here, i am still not able understand the reason.
Please share your thoughts on this
Thanks
推荐答案
我不知道确切的答案,但有几种方法可以检查查询的性能并对其进行优化:
T-SQL调优:如何衡量绩效改进(带视频) [ ^ ]
7个更快的SQL查询的性能提示 [ ^ ]
如何:优化SQL查询 [ ^ ]
SQL调优或SQL优化 [ ^ ]
和我最好的:针对TSQL性能的七种罪行[ ^ ]
请阅读CodeProject知识库中非常有趣的文章:
在SQL Server中优化数据访问的十大步骤:部分我(使用索引) [ ^ ]
十大步骤优化SQL Server中的数据访问:第二部分(重新考虑TSQL并应用最佳实践) [ ^ ]
优化SQL Server数据访问的十大步骤:第三部分(应用高级索引和非规范化) [ ^ ]
我的结论:使用DBCC工具/命令;)
I do not know the exact answer, but there are several ways to check the performance of query(ies) and to optimize it:
T-SQL Tuning: How to Measure Performance Improvements (with Video)[^]
7 performance tips for faster SQL queries[^]
How To: Optimize SQL Queries[^]
SQL Tuning or SQL Optimization[^]
and my best: The Seven Sins against TSQL Performance[^]
Please, read very interesting article from CodeProject Knowledge Base:
Top 10 steps to optimize data access in SQL Server: Part I (use indexing)[^]
Top 10 steps to optimize data access in SQL Server: Part II (Re-factor TSQL and apply best practices)[^]
Top 10 steps to optimize data access in SQL Server: Part III (Apply advanced indexing and denormalization)[^]
My conclusion: use DBCC tools/commands ;)
这篇关于相同SQL查询的执行时间不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!