简体   繁体   中英

How can I capture SQL query performance statistics when executing queries via ADO.NET

When I use Sql Server Profiler, I can see a bunch of useful performance statistics for my queries (CPU, page reads, etc). I'd like to be able to capture these when my .NET code runs queries for logging and benchmarking purposes. To best correlate between the code executing the query and the query statistics, I'd like do do this capturing from within .NET as part of query execution. Is this possible using the ADO.NET (eg SqlConnection) APIs? How can it be done?

Note: I know that .NET can be used to start and stop SQL traces / extended events, but I'm wondering if it's possible to get this information as part of normal query execution on a connection.

否。运行trace是获得您在SQL Server Profiler中看到的详细性能指标所必需的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM