Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

How does MS SQL Server decide when it can use "Parallelism" when executing queries? I recently posted another question here that, when looking at the actual execution plan used parallelism when I had an order by on the query and did not when I didn't have the order by. So, I'm wondering how it figures out when it can use "Parallelism" and when it can't.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

SQL Server makes this decision based upon cost. If you execute 'sp_configure' (make sure advanced options are enabled) you will see an entry for 'cost threshold for parallelism'. If the optimizer estimates the cost to be greater than the run_value then your query will be executed in parallel.

If the ORDER BY clause in your example results in an increased cost, then the query will go parallel.

share|improve this answer
    
Very interesting, thanks. –  Beth - loud ninja - Whitezel Jan 18 '11 at 0:29
1  
You can find more info about the cost calculated for parallelism here: msdn.microsoft.com/en-us/library/ms178065.aspx and here technet.microsoft.com/en-us/magazine/dd320292.aspx . –  Marian Jan 18 '11 at 18:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.