February 10, 2017 at 6:45 am
Am I correct in thinking that sys.dm_exec_query_stats only includes queries that completed sucessfully? If so, is there a way to see queries that were stopped by the calling process, or rolled back, before they completed.
Thanks
Tim
.
February 10, 2017 at 7:09 am
Yes, I think that is correct, although of course you could try it for yourself by clearing the plan cache and then running a statement that you know won't be able to finish (primary key violation, perhaps) and another where you start a transaction, run a statement and then roll back the statement.
An alternative to the DMV you mentioned is an extended events session, which you would have to set up before the statements run. If you specify an Event Pairing target, you can see what commands started but didn't finish.
John
February 10, 2017 at 7:23 am
Tim Walker. - Friday, February 10, 2017 6:45 AMAm I correct in thinking that sys.dm_exec_query_stats only includes queries that completed sucessfully? If so, is there a way to see queries that were stopped by the calling process, or rolled back, before they completed.
Thanks
Tim
sys.dm_exec_requests will give you the information on the current activity.
😎
February 13, 2017 at 7:44 am
John Mitchell-245523 - Friday, February 10, 2017 7:09 AMYes, I think that is correct, although of course you could try it for yourself by clearing the plan cache and then running a statement that you know won't be able to finish (primary key violation, perhaps) and another where you start a transaction, run a statement and then roll back the statement.An alternative to the DMV you mentioned is an extended events session, which you would have to set up before the statements run. If you specify an Event Pairing target, you can see what commands started but didn't finish.
John
Thanks John, an event pairing target definitely looks a good option. I shall give it a go.
Tim
.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply