I want to add monitoring capabilities to a complex process involving many stored procedures. In some cases I want to capture the number of logical reads produced by a single statement.
In other words, I would like to turn on the set statistics io on
, access (and save the results to a log table) what is usually displayed in the SSMS in the "messages" tab.
I saw that it can be done in .Net with SqlInfoMessageEventHandler. I'm sure that it can also be done in T-SQL but i didn't find it yet.
Thanks!
Logical_reads in sys.dm_exec_requests is not increasing as well...
The perfect solution for me would be a way of somehow capturing the "set statistics io on" information :
select name, id
from sysobjects
union all
select name,id
from sysobjects ;
(120 row(s) affected)
Table 'sysschobjs'. Scan count 2, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.