• T.Ashish (9/18/2013)


    But in your blog you are saying "the actual plan costs are still just estimates".

    The costs are estimates, they are always estimates. The only thing actual about an actual plan are the actual executions and actual row counts and a couple of other actual counters.

    So, why SQL is not able to give us the exact costing of what it has done !!!!

    Why would it? The costs are there for the optimiser. They're how the optimiser tells which plan appears to be the best of the ones it found. It's a cost-based optimiser. Once optimisation completes and the query's execution starts, those costs are no longer needed for anything. So why would SQL go to all the expense and effort of calculating run-time costs when the costs are only needed before execution starts?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass