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 > DB2 > Measure Execution time of executed query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-26-08, 05:52
SilencerandLois SilencerandLois is offline
Registered User
 
Join Date: Feb 2008
Posts: 25
Measure Execution time of executed query

Hi!
First of all: i'm a real newbie in DB2!

I have a question on measuring the exectuion time of a "select" query. Is there any command to measure it, and, furthermore ,doesn't print out the result?
I'm using DBVisualizer (free edition).

Hope someone knows some help

Martin
Reply With Quote
  #2 (permalink)  
Old 02-26-08, 07:20
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
go to db2 command window
update monitor switches statement and timestamp
get snapshot for dynamic sql (see infocenter for detail)
will list all executed sql with detailed info
explain will only indicate the cost and not execution time...
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #3 (permalink)  
Old 02-26-08, 08:15
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi,
if using Windows as DB2 client you can use free program DB2 Monitor instead of "get snapshot" command. Download: http://members.tripod.com/chuzhoi_files/index.html
Hope this helps,
Grofaty
Reply With Quote
  #4 (permalink)  
Old 02-26-08, 08:29
SilencerandLois SilencerandLois is offline
Registered User
 
Join Date: Feb 2008
Posts: 25
Hi Groafty,
thanks for the advice.
Starting the programm I just get the error message, that that DB2APP.dll istn't found (the DB2 distirubtion istn't installed on this computer).

Is there no other easy way to get the execution time of a query?
Sorry, but I don't get this with "get snapshot"...

Regards,
Martin
Reply With Quote
  #5 (permalink)  
Old 02-26-08, 10:08
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
db2batch is a tool that comes with DB2 to do permformance analysis.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #6 (permalink)  
Old 02-26-08, 10:21
SilencerandLois SilencerandLois is offline
Registered User
 
Join Date: Feb 2008
Posts: 25
When using db2batch, i have the parameters "Elapsed time" and "CPU Agent time".
Is "CPU Agent Time" the time, which is needed to execute the query without the printout of the resulting tuples?

Regards,
Martin
Reply With Quote
  #7 (permalink)  
Old 02-26-08, 10:49
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
I would turn off the outputting of rows using the following in the SQL script:
Code:
--#SET ROW_OUT 0
You can also turn off fetch itself with this:
Code:
--#SET ROW_FETCH 0
But note that DB2 may actually have to do some work for the fetch if it didn't compute the result set up front. (Computing things up front is not always the best choice, especially if not all rows are retrieved.)
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #8 (permalink)  
Old 02-26-08, 10:54
SilencerandLois SilencerandLois is offline
Registered User
 
Join Date: Feb 2008
Posts: 25
Thanks for the advice!

But which of the two times is then the correct one for me?

Or does there exist still another way to get the pure execution time of a query?

Regards,
Martin
Reply With Quote
  #9 (permalink)  
Old 02-26-08, 11:54
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
That depends on what you want to know. The "CPU Agent time" may not be correct if your query waits for synchronous I/O, for example.

I would use the "elapsed time" and do away with ROW_OUT to not disturb measurements with writing results to standard output.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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