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 > db2pd to find longest running query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-10-11, 03:40
db2cap db2cap is offline
Registered User
 
Join Date: May 2010
Posts: 87
db2pd to find longest running query

Hi,
I am working on DB2 V9.1 on AIX 5.3
Yesterday, the CPU utilization reached 100% and so db2pd was the only option I was left with to analyze the problem. I was asked to kill the longest running query. How do I find it considering the output of db2pd is huge and number of transactions running are 100+
Reply With Quote
  #2 (permalink)  
Old 05-10-11, 10:58
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 294
Hi,

what about
db2pd -db <ABCDE> -activestatements
?
Reply With Quote
  #3 (permalink)  
Old 05-11-11, 08:18
db2cap db2cap is offline
Registered User
 
Join Date: May 2010
Posts: 87
But how I map it to the statement executing?

Also, when i see the output of "db2pd -database <ABCD> -dynamic", I find more than 100+ statements executing under column text then why does it display only 6-7 statements while executing "db2pd -database <ABCD> -activestatements"
Reply With Quote
  #4 (permalink)  
Old 05-12-11, 20:18
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I usually use snapshots to identify a query(ies) consuming more CPU / higher execution time than others.

If db2pd is the only option, then I think you can do "db2pd -edu" to find a db2agent consuming lots of cpu and then using its EDU ID find the appl and the sql (db2pd -app -dyn)
Reply With Quote
  #5 (permalink)  
Old 05-12-11, 22:15
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by db2cap View Post
when i see the output of "db2pd -database <ABCD> -dynamic", I find more than 100+ statements executing
The fact that a statement is in the package cache does not mean that it is being executed when you take the snapshot.
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