Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Long running SPs and CPU ..

Author  Topic 

Hariarul
Posting Yak Master

160 Posts

Posted - 2010-01-04 : 14:18:44
Would long running SPs cause high CPU usage ?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-04 : 15:03:15
It depends. Are the stored procedures long running because they are doing scans due to missing indexes, which is a common cause of high CPU?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-01-04 : 15:20:01
To diagnose , consider analysing your SPs execution plan - for example , concentrate on scans , and see if you have missing indices , which is a common cause

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

Hariarul
Posting Yak Master

160 Posts

Posted - 2010-01-04 : 19:01:42
Thanks for your response. In the stored procedure there is a JOIN in which a huge table is joined with few other tables. This is only a clustered index seek which takes 85% cost in the stored procedure. The scan density is very poor and duration for procedure execution is very high ( 25 seconds in production ). Will this shoot up the % processor usage ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-04 : 19:18:19
If it's a seek, then it shouldn't. But run it to see for yourself what CPU utilization does.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Hariarul
Posting Yak Master

160 Posts

Posted - 2010-01-04 : 20:36:01
When I do a profiling , the duration shows high values but the CPU value is NULL. Have anyone faced this earlier ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-04 : 22:31:19
What event did you use?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Hariarul
Posting Yak Master

160 Posts

Posted - 2010-01-05 : 15:10:32
SP:Completed & RPC:Completed. For most of the records the CPU column value is NULL though it has a high duration and reads.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-05 : 17:26:42
I've never seen it say NULL unless the column was removed the trace definition and later queried via a file.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-06 : 01:44:33
set statistics io on
set statistics time on

execute sp

post results here.

as Tara said, most common cause of high cpu is scanning
Go to Top of Page
   

- Advertisement -