If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > time a SQL quey

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-04, 08:36
TexTwil TexTwil is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
time a SQL quey

Hi,
is there a function in INFORMIX(9.3) that can time a SQL query ?

thaks
Reply With Quote
  #2 (permalink)  
Old 03-11-04, 16:01
bull_abraham bull_abraham is offline
Registered User
 
Join Date: Feb 2004
Posts: 32
Add the following before and after the query........
select distinct current from systables;

-Abraham
Reply With Quote
  #3 (permalink)  
Old 03-11-04, 16:07
TexTwil TexTwil is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
tkanks ! I'll try tomorrow
Reply With Quote
  #4 (permalink)  
Old 03-12-04, 01:05
vpshriyan vpshriyan is offline
Registered User
 
Join Date: Nov 2003
Location: Mumbai, India
Posts: 92
It needs slight change as below:

select current as start_time from systables where tabid=1
into temp x with no log;
-- query to be benchmarked for response time
select current - start_time from systables,x where tabid=1;

Regards,
Shriyan
Reply With Quote
  #5 (permalink)  
Old 03-15-04, 08:07
TexTwil TexTwil is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
hi again,
please what is the type of the returned value ? I want to handle this value in a java program so I need to know the type to be able to take it from my result set:

rs.getInt () ?
rs.getDate() ?
...

thanks
Reply With Quote
  #6 (permalink)  
Old 03-16-04, 07:15
vpshriyan vpshriyan is offline
Registered User
 
Join Date: Nov 2003
Location: Mumbai, India
Posts: 92
Hi,

Well, the return data type is DATETIME DAY TO FRACTION, according to the format below:

DDDDDD HH:MMS.FFF

I'm not a java programmer, so I may not be the right person to think of the equivalent data type in java.

Regards,
Shriyan
Reply With Quote
  #7 (permalink)  
Old 03-16-04, 11:16
TexTwil TexTwil is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
okey thanks anyway
Reply With Quote
  #8 (permalink)  
Old 03-24-04, 15:11
astrue astrue is offline
Registered User
 
Join Date: Dec 2002
Location: Portland, OR, USA
Posts: 26
Is CURRENT your friend? Hmmm...

Hi,

I am not sure if this helps, but I have trouble trusting CURRENT, because of the internals- you cannot see when the db is updating the value of CURRENT. For instance, during execution of a stored procedure, returns the same value, no matter how much time has actually elapsed.

I would suggest that you might be better off doing your timing in your Java code, or barring that, if you have an engine running on the DB server that manages the connections, do it in there.

We're doing it in our C++ request handler, which seems to work pretty well. It really depends on what you're trying to measure: raw database speed, or the time from the beginning to the end of a txn, and whether you're trying to isolate the impacts of network traffic... at least for us.

Hope this helps...

Regards,
Joe
Reply With Quote
  #9 (permalink)  
Old 03-25-04, 13:22
RobP RobP is offline
Registered User
 
Join Date: Mar 2004
Location: Netherlands
Posts: 183
Probably cuurent will give you coorect answers but it only gives you full seconds output. If this is the case you can change this behaviour by setting the configuration parameter OSTIME to 1 instead of 0 (default). Now IDS will not read the time out of shared memory but will do a system call.

Another more advanced solution is to create some stored procedures that will do the trick. Probably C is the best solution is the best idea. This is quite easy to find out. You can read more about this at the developers corner on the informaix part of the IBM website.

Maybe a different approach,

Rob Prop
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On