May 14, 2014 at 9:57 am
hello,
first-timer here.
I was wondering if there is a way to count the number of DMLs ( insert, update, deletes, selects) coming from a SQL process. I am NOT interested in change tracking & CDC. Can we do this using DMVs or Profiler or custom code?
Thanks
May 14, 2014 at 10:48 am
The only way to get a really accurate count would be to use extended events or trace. Since you're 2008 trace will be easier since there is no GUI for extended events, but, ex events have a smaller foot print.
You can get a less accurate measure by querying sys.dm_exec_query_stats or sys.dm_exec_procedure_stats. These show an aggregate count of executions for queries and procedures in cache. You could use the datetime that the query was put in cache as a base to get running totals by calling the procedure over & over (say once an hour) and then compare the values. If the datetime is the same, you record the difference in counts. If the datetime has changed, you start a new count. But that's going to be messy and less accurate.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 15, 2014 at 11:53 am
there is a column called row_count in the dmv dm_exec_sessions. does that give the total number of rows affected by that spid?
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply