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 > Querry Execution time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-16-10, 15:09
nimisha123 nimisha123 is offline
Registered User
 
Join Date: Feb 2010
Posts: 3
Querry Execution time

Hey experts

how can display execution time for a query i.e.time lapse between start and end of executing a query
am not using any DB2 tool for querry,,am direclty using command line,,so pelase help me to find any simple syntax
to get execution time
its very urgent ,am in the middle of a performance tuning,,please help me some DBa experts

Thanks

Nimisha
Reply With Quote
  #2 (permalink)  
Old 02-16-10, 15:37
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
You can use the "db2 get snapshot for dynamic SQL on db-name".

You must first do the following:
  • db2 update monitor switches using statement on
  • db2 reset monitor all
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 02-16-10, 16:06
nimisha123 nimisha123 is offline
Registered User
 
Join Date: Feb 2010
Posts: 3
Hello

thank you so much ,really appreciate ur effort to reply my querry
i tried :db2 get snapshot for dynamic SQL on (dbname)
the problm it bring pages and pages of record,,,,so i cant fetch my latest run SQL, is there any option to get only latest run querry details get fetch or any option to write into a file

am new to Db2,so please clear me the way to resolve this


thanks


Nimisha


Quote:
Originally Posted by Marcus_A View Post
You can use the "db2 get snapshot for dynamic SQL on db-name".

You must first do the following:
  • db2 update monitor switches using statement on
  • db2 reset monitor all
Reply With Quote
  #4 (permalink)  
Old 02-16-10, 17:21
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by nimisha123 View Post
Hello

thank you so much ,really appreciate ur effort to reply my querry
i tried :db2 get snapshot for dynamic SQL on (dbname)
the problm it bring pages and pages of record,,,,so i cant fetch my latest run SQL, is there any option to get only latest run querry details get fetch or any option to write into a file

am new to Db2,so please clear me the way to resolve this


thanks


Nimisha
I realize you will get a lot junk, but all the junk should have an execution time of zero (except the one SQL you run after you reset the montor).

To make the file smaller (but not as small as you want it) you can try this:
  • db2 connect to db-name
  • db2 flush package cache dynamic
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 02-16-10, 17:31
nimisha123 nimisha123 is offline
Registered User
 
Join Date: Feb 2010
Posts: 3
is there any syntax to write the snapshot into a file in a speciafied path as text or some other format,,,
Reply With Quote
  #6 (permalink)  
Old 02-16-10, 18:52
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Try using the time command:
time db2 -tvf <query>
Reply With Quote
  #7 (permalink)  
Old 02-16-10, 19:57
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by nimisha123 View Post
is there any syntax to write the snapshot into a file in a specified path as text or some other format,,,
You need to learn some basic operating system commands such as piping an output to a file (that have nothing to do with DB2):

db2 get snapshot for dynamic SQL on db-name > snapshot.txt
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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