SQL Server 2005 Express - Activty Monitor - Show details is empty, how can I tell what the SQL statement that started the process is? -
trying fix problem on our server - expensive query using lot of our cpu.
when use activity monitor, can use show details process, , show sql running query. not though.
i can see process now, how can tell query text responsible? can identify source if have sql, @ moment have nothing!
try using following query.
select top 20 qs.sql_handle, qs.execution_count, qs.total_worker_time total_cpu, total_cpu_inseconds = --converted microseconds qs.total_worker_time/1000000, average_cpu_inseconds = --converted microseconds (qs.total_worker_time/1000000) / qs.execution_count, qs.total_elapsed_time, total_elapsed_time_inseconds = --converted microseconds qs.total_elapsed_time/1000000, st.text, qp.query_plan sys.dm_exec_query_stats qs cross apply sys.dm_exec_sql_text(qs.sql_handle) st cross apply sys.dm_exec_query_plan (qs.plan_handle) qp order qs.total_worker_time desc
then may suggest copy of awesome sp_whoisactive stored procedure written , shared free courtesy of adam machanic. can use procedure identify running queries, including wealth of associated information such amount of cpu used, io, execution plan, query text, blocking etc.
Comments
Post a Comment