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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

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


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.
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.
try running the With maxdop Set at 1

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
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

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.
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..
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.
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.