473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Estimate the Time for SQL query Execution

Is there any way to estimate the time required to execute a T-SQL statement?
I need to set the command time out by calculating the time for T-SQL
statement. Can any one give an example?
Nov 17 '05 #1
4 9163
In message <#c**************@TK2MSFTNGP12.phx.gbl>, Saradhi
<up*******@inooga.com> writes
Is there any way to estimate the time required to execute a T-SQL statement?
I need to set the command time out by calculating the time for T-SQL
statement. Can any one give an example?


You're probably better asking in somewhere like
microsoft.public.sqlserver.programming.

Having said that, it depends on too many factors for it to be a
particularly useful thing to do, in my opinion. What hardware will it
run on, how busy will the server be at the time, how many records will
there be in the tables, etc.

The decision on timeout has less to do with how long the command takes
to execute and more to do with your system requirements; how long is the
user willing to wait? Is it essential that the operation completes
however long it takes? Is running it asynchronously an option?

--
Steve Walker
Nov 17 '05 #2
Les
Saradhi,
I've seen a few tools that try to do just what you are asking, specifically
Oracle has a estimator and to be truthful, it is almost worthless if the
query is going to be of any significant complexity. You can kind of get a
rough idea of time for moderate queries, but large ones are very hit and miss
at best.

While I do not have an algo for your or other suggestions, I would take a
look at other paths, this one can really suck a lot of time and not give you
much return.

"Saradhi" wrote:
Is there any way to estimate the time required to execute a T-SQL statement?
I need to set the command time out by calculating the time for T-SQL
statement. Can any one give an example?

Nov 17 '05 #3
Why don't you test your query and see, Get the best time, the wrost time and
then get an average time ? Other important thing is how long is the user
willing to wait?
"Les" <Le*@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
Saradhi,
I've seen a few tools that try to do just what you are asking, specifically Oracle has a estimator and to be truthful, it is almost worthless if the
query is going to be of any significant complexity. You can kind of get a
rough idea of time for moderate queries, but large ones are very hit and miss at best.

While I do not have an algo for your or other suggestions, I would take a
look at other paths, this one can really suck a lot of time and not give you much return.

"Saradhi" wrote:
Is there any way to estimate the time required to execute a T-SQL statement? I need to set the command time out by calculating the time for T-SQL
statement. Can any one give an example?

Nov 17 '05 #4
oj
Totally agree with Steve here. The decision for Timeout property should be
decided on the business/client need/expectation. Trying to dynamically set
this property is insane. Network congestion, server busy, etc can greatly
affect the final outcome.

In general, for simple *read-only* type query with a small set of data, 1
minute should be plenty. However, if you have some complex logic and/or
other external calls, you will have to jack the timeout up.

--
-oj
"Steve Walker" <st***@otolith.demon.co.uk> wrote in message
news:DW**************@otolith.demon.co.uk...
In message <#c**************@TK2MSFTNGP12.phx.gbl>, Saradhi
<up*******@inooga.com> writes
Is there any way to estimate the time required to execute a T-SQL
statement?
I need to set the command time out by calculating the time for T-SQL
statement. Can any one give an example?


You're probably better asking in somewhere like
microsoft.public.sqlserver.programming.

Having said that, it depends on too many factors for it to be a
particularly useful thing to do, in my opinion. What hardware will it run
on, how busy will the server be at the time, how many records will there
be in the tables, etc.

The decision on timeout has less to do with how long the command takes to
execute and more to do with your system requirements; how long is the user
willing to wait? Is it essential that the operation completes however long
it takes? Is running it asynchronously an option?

--
Steve Walker

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Damien | last post by:
Hello to all, I've written a script that take quite a long time to execute (email sending). Last time I ran it, PHP gave me a "execution time limit exceeded" (or something like that), so I changed...
0
by: anita hery | last post by:
Hi All I found an error ( run time error 3669. Execution cancelled) when ran the following query via VB6 SP5. select crc,month,sum(v) as v from ( select crc,v, case when fadate between...
18
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the...
5
by: mas | last post by:
I have a Stored Procedure (SP) that creates the data required for a report that I show on a web page. The SP does all the work and just returns back a results set that I dump in an ASP.NET...
1
by: UnixSlaxer | last post by:
Hello all, I installed the trial version of DB2 UDB 8.2, I was wondering, how can I determine the exact execution time (in miliseconds not timerons) for a specific query ? Thank you very...
31
by: Bob | last post by:
I have recently joined a healthcare company where I am the solo programmer. I am going to be starting work on a project. The management has asked me to provide an estimate of hours I am going to...
3
by: iam980 | last post by:
Hello All. We have tested following SQL script from query analyzer: -- Script begin DECLARE @I int; SET @I = 1; WHILE @I < 10000000 BEGIN SET @I = @I + 1; END -- Script end
3
by: M Bourgon | last post by:
On SSMS 9.00.3042.00, any query that runs longer than 10 minutes gets the following error message: The statement has been terminated. Msg -2, Level 11, State 0, Line 0 Timeout expired. The...
3
by: rcamarda | last post by:
Hello, I ran a query that I thought would take an hour, but instead took 14 hours to run. The consequence was it bogged down our data warehouse and the overnight build was adversely impacted. Is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.