Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retreive estimated query cost

Status
Not open for further replies.

YeloowMan

Programmer
Jun 28, 2001
2
CA
Im writing a report generator, this program build a query dynamically. And i wish to prevent to long query from executing. I know that i can have the estimated query cost with sql Query analyzer, but i cant find a way to get in from the application..
I am searching a kind of function that receive the query in parameter and return the estimated query cost..
It is possible? and how?

NB. I am using Coldfusion language but i dont think this is important .. it must be a kind of procedure or dll call?

Thanks in the advance
 

I'm not aware of any method, action or DLL available to provide query cost to a client application. You may already be aware that SQL Server 7 and 2000 provide an option to prevent long, costly queries from running. The query governor cost limit option can be set on with a specified maximum estimated cost.

See the topic "How to set the query governor cost limit option (Enterprise Manager)" in SQL BOL. Terry
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Hi thanks you for your reply, i already aware that the query governor exist, but it throw and error when the estimated query cost exceed the specified value.
So i dont want to throw an error in my application and Error handling may not be a good idea because all the database is affected by the query governor.

What i want to do :
I want to find a way to check if the query for the report will be long. If so, i want to schedule the report in the night and the result will be available in the next day. In that way, the report will not affect the overral performance of the whole application (This is a kind of big app).

The only problem i got.. is how to determine the "query cost" before i run the query.

Any help would be appreciated.

Platform : SQL server 7.0
Programming lang : Cold Fusion 4.5
OS : Windows NT 4.0




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top