How to benchmark a SQL Server Query?

故事扮演 提交于 2019-12-12 07:54:20

问题


I'd like to know the standard way to benchmark a SQL Sever Query, preferably I'd like to know about the tools that come with SQL Server rather than 3rd Party tools.


回答1:


set showplan_text on will show you the execution plan (to see it graphically use CTRL + K (sql 2000) or CTRL + M (sql 2005 +)

set statistics IO on will show you the reads

set statistics time on will show you the elapsed time




回答2:


Use SQL Profiler.

For .NET applications, filter that Application name by '.NET%' and you'll omit other extraneous queries.




回答3:


+1 on the execution plan. From here you can see where all the time is being spent in your particular query. Eg. 85% of the time is spent table scanning a particular table, can you put an index on that table to improve it? etc etc.



来源:https://stackoverflow.com/questions/34858/how-to-benchmark-a-sql-server-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!