SQL server 2008 sql query spikes the processor to 95% to 99%

There is SQL query that joins  multiples sql views and totalling around 15 Inner Join/Outer Joins. The Query actually does a count(*) on the result. The query itself takes 3 minutes to run which is fine. However, it forces the database server to 99%. The configuration is : SQL server 2008 enterprise ed on Windows server 2008 enterprise ed with 4 quad core processors and 32 GB RAM. The tables are partitioned and have around 60 million records. The indexes are set and the Database tuning wizard/Execution plan all seems to be fine.
Since it forces to 99%, all the server access is blocked and the rest of the regular business applications timeout - that have queries running on this server and throw errors.




pkscAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bchoorCommented:
did u look at Resource Governor? This is a good start:

http://www.sql-server-performance.com/articles/per/Resource_Governor_in_SQL_Server_2008_p1.aspx

It sounds like a faily complex query, and a very large dataset. 3 mins is pretty impressive actually, sounds like you have a pretty beefy box.
0
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Since you have ideally identified the query responsible for the resource issue, its time to tune that query now..
Either post the query here so that we can check whether it can be tuned out or use Database Tuning Advisor to suggest for some missing indexes to improve the performance of the query.
0
mikkilineniCommented:
try running the With maxdop Set at 1
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

pkscAuthor Commented:
@mikkilineni, That query hint really indeed help - though it takes thrice the time it takes to finish. However, the query could be classified as long process and it should be fine. Great answer. I am not sure still why parallelism is bad. I will mark as solution unless we really make progress. Thanks.
0
mikkilineniCommented:
try this Query and find the optimal value ,which you cans et at the server level..and will not need a maxdop hint..at the query  level..

select case
         when cpu_count / hyperthread_ratio > 8 then 8
         else cpu_count / hyperthread_ratio
       end as optimal_maxdop_setting
from sys.dm_os_sys_info;

Changing this value would not need a restart of the service..
 
0
pkscAuthor Commented:
The other queries slowed down when server level maxDOP is set at 4(based on the server config). We will do the query hint for this query and all is well.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.