/*top 10 queries by avg cpu time*/
SELECT top 10
rowid=row_number() over(order by total_worker_time/execution_count desc)
,last_execution_time
, 'last_elapsed_time(ms)'= last_elapsed_time/1000
, 'avg_elapsed_time(ms)'= total_elapsed_time/execution_count/1000
, 'last_cpu_time(ms)'=last_worker_time/1000
, 'avg_cpu_time(ms)'=total_worker_time/execution_count/1000
, total_logical_reads, total_logical_writes
, execution_count
, (SELECT SUBSTRING(text, statement_start_offset/2 + 1,
...