Search code examples
sql-serversql-server-2005sql-execution-planindexing

Query cost relative to batch is 100%


I'm not sure sure how to interpret this, but all the queries I run in sql server 2005 have a "query cost (relative to batch)" of 100%. Is there any way to reduce the cost?


Solution

  • If your batch (what you are executing within a given call) has one query then relative to that batch that query takes up 100% as it is the only query within that batch.

    I.e.:

    BEGIN
      SELECT * FROM table -- Will be 100% of batch
    END
    
    BEGIN
      SELECT * FROM table -- Will be 50% of batch
      SELECT * FROM table -- Will be 50% of batch
    END
    
    SELECT * FROM table -- Will be 100% of batch (implicit begin/end around it)