x

cpu utilization

Good Morning , From task manager noticed CPU utilization for sqlserver.exe is 90%.We are using sql server 2008. How to understand which sql process is occupying that 90% of CPU volume? is there any query ? command? dmv? on which database it can be run to understand 90% of CPU utilized by which processess?

Can you please advise

Thank you
more ▼

asked Sep 18, 2012 at 07:57 AM in Default

pits gravatar image

pits
830 82 91 92

You can use this DMV :)

SELECT TOP 10 (total_worker_time * 1.0) / 1000000 AS CPU_Utilized_in_Seconds, text,* FROM sys.dm_exec_query_stats CROSS APPLY sys.dm_exec_sql_text(sql_handle)
Sep 18, 2012 at 11:59 AM SumitRana
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

I use the query below in relation to using Process explorer.

SELECT 
 r.session_id, st.text, qp.query_plan, r.status, os_thread_id
FROM 
 sys.dm_os_threads AS ot
 JOIN sys.dm_os_tasks AS t ON t.worker_address = ot.worker_address
 JOIN sys.dm_exec_requests AS r ON t.session_id = r.session_id
 CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS st
 CROSS APPLY sys.dm_exec_query_plan(r.plan_handle) AS qp

A video from Jonathan that will walk you through it is here (saved me a few times - thanks!)

I work with 2 monitors, so that you can have PE in one windows showing the tread that is consuming high CPU and the query in the other windows with the related SQL.

more ▼

answered Sep 18, 2012 at 08:37 AM

sp_lock gravatar image

sp_lock
9.2k 25 28 31

(comments are locked)
10|1200 characters needed characters left

You can use this DMV :)

SELECT TOP 10 (total_worker_time * 1.0) / 1000000 AS CPU_Utilized_in_Seconds, text,* FROM sys.dm_exec_query_stats CROSS APPLY sys.dm_exec_sql_text(sql_handle)
more ▼

answered Sep 18, 2012 at 12:00 PM

SumitRana gravatar image

SumitRana
180 6 9 11

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x5

asked: Sep 18, 2012 at 07:57 AM

Seen: 700 times

Last Updated: Sep 18, 2012 at 12:00 PM