Hi all,
I am using this
SELECT *
FROM sys.dm_exec_query_stats s
CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t
ORDER BY
s.max_elapsed_time DESC
to get the longest running queries on the server level.
How do I get the longest running queries per database? I would like to focus only on one database at a time.
Thanks, Edi