cost threshold for parallelism setting

  • Hi All,

    I want to change "cost threshold for parallelism" from 5 to 25 as we are seeing high cpu. Even small queries are getting parallelised.
    Ours is a SQL Azure db. Can we change this setting on azure db? If so, how can we do that?

    Thanks,

    Sam

  • You can't change that setting in Azure SQL Database currently. You can use Database Scoped Configuration to control the MAXDOP, but I'm not a fan of this approach.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • vsamantha35 - Sunday, December 10, 2017 9:40 PM

    Hi All,

    I want to change "cost threshold for parallelism" from 5 to 25 as we are seeing high cpu. Even small queries are getting parallelised.
    Ours is a SQL Azure db. Can we change this setting on azure db? If so, how can we do that?

    Thanks,

    Sam

    This probably (very highly likely) isn't a problem with "cost threshold for parallelism".  It's probably a code problem that needs to be addressed (read that as researched and fixed) especially if you're seeing high CPU usage.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Grant Fritchey - Monday, December 11, 2017 6:34 AM

    You can't change that setting in Azure SQL Database currently. You can use Database Scoped Configuration to control the MAXDOP, but I'm not a fan of this approach.

    Hi Sir, Thanks for the response. One followup question, if I not able to cost threshold of parallelism is it not so where we end up even small queries getting over parallelised? and on the other hand , lets say, if I have checked the actual execution plan and see small query getting over parallelised and because of which I had used OPTION(MAXDOP = 1) hint. If I do so, whenever I am do a stress testing 50 - 60 concurrent users , will there be a scenario where only 1 core is getting overloads and other ones are sitting idle ? basically, would like know how to have the right balance in such scenarios ??

  • vsamantha35 - Tuesday, December 12, 2017 11:37 AM

    Hi Sir, Thanks for the response. One followup question, if I not able to cost threshold of parallelism is it not so where we end up even small queries getting over parallelised? and on the other hand , lets say, if I have checked the actual execution plan and see small query getting over parallelised and because of which I had used OPTION(MAXDOP = 1) hint. If I do so, whenever I am do a stress testing 50 - 60 concurrent users , will there be a scenario where only 1 core is getting overloads and other ones are sitting idle ? basically, would like know how to have the right balance in such scenarios ??

    Jeff has largely nailed it. Most of your queries shouldn't go parallel if you're tuning them and running them against a good structure with appropriate indexing. However, you don't have that control, so there really is no other solution for it at this time.
    I really don't like using the MAXDOP hint or database configuration unless there is no other option. However, it's possible that you could see that kind of stress occurring if you do. Again, you have fewer knobs to tweak on Azure SQL Database.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply