开发者

Query cost relative to batch is 100%

开发者 https://www.devze.com 2023-01-06 10:45 出处:网络
I\'m not sure sure how to interpret this, but all the queries I run in sql server 2005 have a \"query co开发者_Python百科st (relative to batch)\" of 100%. Is there any way to reduce the cost?If your b

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


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)


As long as there is only one query in your batch, it's cost relative to the batch will always be 100%. If you have more than one query in the batch, they will add up to 100%.

The percentage only shows how queries in the batch relate to each other, it's not an absolute measure of the cost. Even if the cost is minimal, it's still always 100%.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号