SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to calculate Query cost
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kneel
Starting Member

India
36 Posts

Posted - 08/29/2007 :  05:26:06  Show Profile  Reply with Quote
hello,

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

--kneel

spirit1
Cybernetic Yak Master

Slovenia
11750 Posts

Posted - 08/29/2007 :  05:30:03  Show Profile  Visit spirit1's Homepage  Reply with Quote
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

India
36 Posts

Posted - 08/29/2007 :  05:37:09  Show Profile  Reply with Quote
thanx for quick reply....To optimize query i need to calculate cost.

--kneel

Edited by - kneel on 08/29/2007 05:38:24
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11750 Posts

Posted - 08/29/2007 :  05:38:36  Show Profile  Visit spirit1's Homepage  Reply with Quote
cost of what?

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

AndrewMurphy
Flowing Fount of Yak Knowledge

Ireland
2916 Posts

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

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 08/29/2007 :  06:13:12  Show Profile  Reply with Quote
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

Slovenia
11750 Posts

Posted - 08/29/2007 :  06:20:10  Show Profile  Visit spirit1's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000