Need help to understand What's the Query Cost?

  • Hi,

    I'm a beginner in Execution Plan. Can someone tell me what's the Query Cost means?

    Part of the execution, it'll showing 100%, 50%, 0%, 99% and so on

    Please help me to understand what's the % means?

  • Total cost to execute a query is 100%. In execution plan this 100% is divided across each part. For example to run a query (100%) with table scan (65%) and sort (35%).

  • The cost of an execution plan is just an estimate based on how many CPU and I/O resources that the query optimizer estimates that query will use.

    You can use this number to compare between two queries, but, because it's an estimate, it can be horribly wrong. This means you can't count on it as an accurate measure of performance. Instead, concentrate on I/O and execution time.

    The total cost of the plan is the accumulation of the estimated costs of all the operations within that plan.

    Although I don't like my explanation of plan costs (it's been updated in the new version which should come out as an e-book soon), for more information, try the execution plans book in my signature line.

    "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

  • Grant Fritchey (1/10/2012)


    The cost of an execution plan is just an estimate based on how many CPU and I/O resources that the query optimizer estimates that query will use.

    You can use this number to compare between two queries, but, because it's an estimate, it can be horribly wrong. This means you can't count on it as an accurate measure of performance. Instead, concentrate on I/O and execution time.

    One of the most important things is that the execution cost is an estimate according to sql server statistics.

    The total cost of the plan is the accumulation of the estimated costs of all the operations within that plan.

    Although I don't like my explanation of plan costs (it's been updated in the new version which should come out as an e-book soon), for more information, try the execution plans book in my signature line.

    you can got the IO/execution time using the script below

    SET STATISTICS TIME ON

    SET STATISTICS IO ON

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

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