Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Ingres Forums > Contributor's Forum
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2010-03-15   #1 (permalink)
Ingres Community
 
Join Date: Oct 2007
Location: China
Posts: 54
Default Display query execution time in sql monitor

How to display query execution time in sql monitor as vdba?
xiongwei is offline   Reply With Quote
Old 2010-03-15   #2 (permalink)
Ingres Community
 
rhann's Avatar
 
Join Date: Mar 2007
Location: roy.hann@rationalcommerce.com
Posts: 434
Blog Entries: 15
Default

AFAIK there is no direct way to display the elapsed time of a query in VDBA, but you can work it out to the resolution of one second by noting the time before and after running the query as follows:
Code:
select date('now');
select blah blah blah;
select date('now');
If you are timing a very fast query you'll either have to write an application to measure the response time, or time running the query a thousand times and divide the total time by a thousand.
__________________
Roy Hann

UK Ingres User Association Conference 2011 will be on Tuesday June 7, 2011. Mark the date in your diary.
rhann is offline   Reply With Quote
Old 2010-03-15   #3 (permalink)
Ingres Community
 
daryl.monge@ingres.com's Avatar
 
Join Date: Mar 2007
Posts: 88
Default

Also look at the backslash operators in the terminal monitor; in particular \t
daryl.monge@ingres.com is offline   Reply With Quote
Old 2010-03-15   #4 (permalink)
Ingres Community
 
Join Date: Oct 2007
Location: China
Posts: 54
Default

thanks.
I used select dbmsinfo('dbms_cpu'), but I am not sure what the value of the dbmsinfo function means.
xiongwei is offline   Reply With Quote
Old 2010-03-15   #5 (permalink)
Ingres Community
 
denjo02's Avatar
 
Join Date: Mar 2007
Location: Melbourne, Australia
Posts: 199
Default

"select local_time" seems to return what you want. When run against a Solaris server it returns a figure like this:

14:14:32.958787850

which seems to have enough decimal places for anybody.....

Incidentally, I always seem to have trouble finding these constants. They appear in the SQL Reference Guide in Chapter 3, a section titled (curiously enough) SQL Constants.

Last edited by denjo02; 2010-03-15 at 08:23 PM.
denjo02 is offline   Reply With Quote
Old 2010-03-16   #6 (permalink)
Ingres Community
 
kschendel's Avatar
 
Join Date: Mar 2007
Location: Pittsburgh, PA
Posts: 1,230
Send a message via Skype™ to kschendel
Default

Quote:
Originally Posted by xiongwei View Post
thanks.
I used select dbmsinfo('dbms_cpu'), but I am not sure what the value of the dbmsinfo function means.
Don't use 'dbms_cpu'. If you ask for dbmsinfo('_cpu_ms'), you'll get a measure of the actual CPU time used by that session since it started. (The CPU time claims to be in milliseconds, but it's only good to about 0.01 second.) 'dbms_cpu' is supposed to return the CPU time used by all sessions, and I don't know how correct it is on OS-threaded servers.
kschendel is offline   Reply With Quote
Old 2010-03-18   #7 (permalink)
Ingres Community
 
Join Date: Oct 2007
Location: China
Posts: 54
Default

Thank the reply from Karl and denjo.
I want to get some performance informations about a single query, such as the CPU time, I/O times and so on. Can you tell me some advice?
xiongwei is offline   Reply With Quote
Old 2010-03-18   #8 (permalink)
Ingres Community
 
kschendel's Avatar
 
Join Date: Mar 2007
Location: Pittsburgh, PA
Posts: 1,230
Send a message via Skype™ to kschendel
Default

select dbmsinfo('_bio_cnt'),dbmsinfo('_dio_cnt'),dbmsinfo ('_cpu_ms'),dbmsinfo('_et_sec');
run the query;
select dbmsinfo('_bio_cnt'),dbmsinfo('_dio_cnt'),dbmsinfo ('_cpu_ms'),dbmsinfo('_et_sec');

and subtract the first set of dbmsinfo values from the second. The difference is the query time. _bio_cnt is the number of messages to and from the client (usually not very interesting), _dio_cnt is the disk IO count, _cpu_ms is the CPU time in milliseconds, and _et_sec is the wall clock time in seconds. All are for your session only.
kschendel is offline   Reply With Quote
Old 2010-03-23   #9 (permalink)
Ingres Community
 
Join Date: Oct 2007
Location: China
Posts: 54
Default

thanks karl.
xiongwei is offline   Reply With Quote

Reply


Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved