Is there a way to capture STATISTICS IO and TIME within T-SQL, for logging into a table?
Is there a way to capture STATISTICS IO and TIME within T-SQL, for logging
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sort of.
The same statistics as those given by
SET STATISTICS TIMEare captured by the Query Statistics DMV:sys.dm_exec_query_stats.DMVs can be queried from T-SQL, just like normal views.
However, the
SET STATISTICS IOare only captured as aggregate values (last_logical_reads, last_physical_read) per execution, without the differentiation per-rowset given bySET STATISTICS IO.Overall though, the DMVs can serve the same purpose as
SET STATISTICS IO.