问题描述
在通过Management Studio中执行T-SQL查询,我可以使用 SET统计IO ON
和 SET统计TIME ON
捕获统计信息查询调优。
When executing T-SQL queries via Management Studio, I can use SET STATISTICS IO ON
and SET STATISTICS TIME ON
to capture statistics for query tuning.
我怎么能收集时,我使用的是.NET客户端的API来执行使用Mangaement Studio的用户界面的T-SQL查询,而不是相同的统计信息?
How can I gather the same statistics info when I'm using .NET client APIs to execute T-SQL queries instead of using Mangaement Studio's UI?
这似乎是一个明显的事情可以做,但搜索MSDN和谷歌相当长的一段时间后,我难倒。最近的事情,我发现是提供统计数据的SQL Server(ADO.NET) MSDN上,但这些统计数据似乎是客户端的统计数据有关网络连接(如字节发送/接收),从客户的角度出发,而不是服务器端统计信息我要找的。
This seems like an obvious thing to be able to do, but after searching MSDN and Google for quite a while, I'm stumped. The closest thing I found was Provider Statistics for SQL Server (ADO.NET) on MSDN, but those stats seem to be client-side stats about network connectivity (e.g. bytes sent/received) from the client's perspective, not the server-side statistics I'm looking for.
推荐答案
请参阅答案的这个问题。
统计信息只是储存在邮件选项卡。
The statistics info is just stored in the messages tab.
如果您使用 SET统计...
用这个方法,你应该能够得到你所追求的。
If you use SET STATISTICS...
with this method you should be able to get what you are after.
这篇关于通过ADO.NET检索SET统计IO和SET统计TIME值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!