dbTalk Databases Forums  

Which part of access plan is active?

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Which part of access plan is active? in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Troels Arvin
 
Posts: n/a

Default Which part of access plan is active? - 08-17-2011 , 08:57 AM






Hello,

I have a query which runs well in the first 15-30 minutes (lots of user-
mode CPU-time and/or lots of I/O), but which then deteriorates into a
situation with only CPU wait-time and close to no I/O (80 read-I/Os per
second, yielding around 1MB/s). The deteriorated state may last for more
than a day (after which I kill the query and give up).

The query is expected to be very heavy, but I can't find an explanation
as to why the query degenerates into the zombie-like state after a while.

Let's call the server which displays the above situation "zombie".

On another server - let's call it "tarzan" - the same query runs within
around two hours. There doesn't seem to be any differences between the
table/index structures between the two servers, although some object
names are slightly different.

Query-explains on the two servers yield slightly different total cost
estimations:
zombie: 13530173
tarzan: 17700850

Clearly, the cost estimation on "zombie" is way off in comparison with
reality.

The query involves five UNIONs, resulting in five different "legs" on the
access plans. The two servers to choose different access plans for some
of these "legs", so I'm intested in finding out which "leg(s)" is being
worked on when the "zombie" is in it's degenerate state.

Is there a way to find out which part of an access plain is currently
being worked on?

--
Troels

Reply With Quote
  #2  
Old   
Yonghang Wang
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-17-2011 , 09:20 AM






try any luck this way,

select distinct db_name, left(stmt_text,2000) from SYSIBMADM.SNAPSUBSECTION

Reply With Quote
  #3  
Old   
Troels Arvin
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-17-2011 , 04:25 PM



Yonghang Wang wrote:
Quote:
try any luck this way,

select distinct db_name, left(stmt_text,2000) from
SYSIBMADM.SNAPSUBSECTION
Thanks, but that doesn't seem to give me a clue as to which part of the
access plan is currently being executed.

--
Troels

Reply With Quote
  #4  
Old   
Yonghang Wang
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-18-2011 , 09:57 AM



Troels, thanks for letting me know that doesn't work.

Reply With Quote
  #5  
Old   
Yonghang Wang
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-18-2011 , 10:06 AM



Troels, basically I believe all branches are alive if they all take time.

to determine which part are running, try combination as below,

1. run db2exfmt/db2expln to get the access plan. pls see to the "subsection".
you will see the two branches are subsection #1 and #2.
RETURN
( 1)
Quote:
UNION
( 2)
/ \
GRPBY GRPBY
( 3) ( 9)
Quote:
|
MBTQ MBTQ
( 4) ( 10)
Quote:
|
GRPBY GRPBY
( 5) ( 11)
Quote:
|
TBSCAN TBSCAN
( 6) ( 12)
Quote:
|
SORT SORT
( 7) ( 13)
Quote:
|
TBSCAN TBSCAN
( 8) ( 14)
Quote:
|
Table: Table:
xxx yyy
2. run the sql.
3. get the snapshot for the application which is running the sql. you will get the running subsection #.

......
Dynamic SQL statement text:
select 'x', xxx, count(*) from xxxx group by xxx_idn union all select 'y', yyy, count(*) from yyyy group by yyy

Subsection number = 1
Subsection database partition number = 1
Subsection status = Executing
Execution elapsed time (seconds) = 27
Total user CPU time (sec.ms) = 14.860000
Total system CPU time (sec.ms) = 0.210000
Current number of tablequeue buffers overflowed = 0
Total number of tablequeue buffers overflowed = 0
Maximum number of tablequeue buffers overflowed = 0
Rows received on tablequeues = 0
Rows sent on tablequeues = 0
Rows read = 2042650
Rows written = 0
Number of agents working on subsection = 1

Agent process/thread ID = 26835

Subsection number = 2
Subsection database partition number = 1
Subsection status = Executing
Execution elapsed time (seconds) = 27
Total user CPU time (sec.ms) = 14.160000
Total system CPU time (sec.ms) = 0.270000
Current number of tablequeue buffers overflowed = 0
Total number of tablequeue buffers overflowed = 0
Maximum number of tablequeue buffers overflowed = 0
Rows received on tablequeues = 0
Rows sent on tablequeues = 0
Rows read = 1922264
Rows written = 0
Number of agents working on subsection = 1

Agent process/thread ID = 12558

Reply With Quote
  #6  
Old   
Troels Arvin
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-18-2011 , 06:28 PM



Yonghang Wang wrote:
[...]
Quote:
3. get the snapshot for the application which is running the sql. you
will get the running subsection #.
Ah, now I get it (I think). Thanks a lot.

--
Troels

Reply With Quote
  #7  
Old   
Troels Arvin
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-19-2011 , 04:27 AM



Hello again,

Yonghang Wang wrote:
Quote:
3. get the snapshot for the application which is running the sql. you
will get the running subsection #.
It seems that no matter which query is running, I always get
Section number = 203

This leads me to think that GET SNAPSHOT FOR APPLICATION's section number
information cannot really be used to get an impression of which part(s) of
an execution plan is currently being worked on.

--
Troels

Reply With Quote
  #8  
Old   
Yonghang Wang
 
Posts: n/a

Default Re: Which part of access plan is active? - 08-22-2011 , 09:12 AM



DPF? you need to run the GET SNAPSHOT FOR APPLICATION on data partition.

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.