Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to calculate Query cost

Author  Topic 

kneel
Starting Member

36 Posts

Posted - 2007-08-29 : 05:26:06
hello,

Does anybody knows how to calculate cost of query ? Any help link or something.

--kneel

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-29 : 05:30:03
the query optimizer does this by itself. you can't do it by hand.

why would you need this?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

kneel
Starting Member

36 Posts

Posted - 2007-08-29 : 05:37:09
thanx for quick reply....To optimize query i need to calculate cost.

--kneel
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-29 : 05:38:36
cost of what?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2007-08-29 : 06:11:37
To optimise query you need to remove poorly performing sections....
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-08-29 : 06:13:12
Just use ctrl + L. It will show you the query plan and cost(s), and help you tweak your query. You can lookup the terms from the plan in BOL.

Jim
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-29 : 06:20:10
Ctrl + L will give you an estimated plan based on current statistics which can be out of date.
so before you do that make sure you update them.

but the best way to optimize your queries is to rewrite them to set based.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -