Select (total_elapsed_time/execution_count)/1000 n' average time Ms ', total_elapsed_time/1000 n' total time spent Ms', total_worker_time/1000 n' total CPU time Ms ', total_physical_reads n 'Total number of physical reads ', Bytes/execution_count n' total number of logical reads', total_logical_reads n' total number of logical reads ', total_logical_writes n' total number of logical writes ', execution_count n 'execution times', substring (St. text, (Qs. statement_start_offset/2) + 1, (Case statement_end_offsetwhen-1 then datalength (St. text) else Qs. statement_end_offset end-Qs. statement_start_offset)/2) + 1) n'execution statement', creation_time n'statement compilation time', last_execution_time n'last execution time' fromsys. dm_exec_query_stats as QS cross apply sys. dm_exec_ SQL _text (Qs. SQL _handle) stwheresubstring (St. text, (Qs. statement_start_offset/2) + 1, (Case statement_end_offsetwhen-1 then datalength (St. text) else Qs. statement_end_offset end-Qs. statement_start_offset)/2) + 1) Not like '% fetch %' order bytotal_elapsed_time/execution_count DESC;
Go to: http://www.chinaret.com/user/topic_view.aspx? T = 1 & U = Admin & id = 89c86964-7af2-4729-8efc-f8fd3fc3f48a