dbTalk Databases Forums  

db2expln vs explain plan

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


Discuss db2expln vs explain plan in the comp.databases.ibm-db2 forum.



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

Default db2expln vs explain plan - 11-30-2011 , 11:11 AM






Can someone please explain the difference between the following;

db2expln -d mydb -u myuser mypw -o outputfile -q "select * from
mytable"

and

db2 "explain plan for select * from mytable"


Ultimately what I want to do is to use db2exfmt but if I run db2expln
the explain tables are not populated. When I used "explain plan"
they are.

What am I missing here? Does db2expln not populate the explain
tables ... or am I doing something wrong?

Thanks!

Wendy

Reply With Quote
  #2  
Old   
Helmut Tessarek
 
Posts: n/a

Default Re: db2expln vs explain plan - 11-30-2011 , 06:30 PM






Hi Wendy,

Quote:
What am I missing here? Does db2expln not populate the explain
tables ... or am I doing something wrong?
You are correct, db2expln does not populate the explain tables.

Furthermore the output of db2exfmt has more detailed optimizer information.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab

Reply With Quote
  #3  
Old   
Wendy
 
Posts: n/a

Default Re: db2expln vs explain plan - 12-01-2011 , 08:23 AM



On Nov 30, 7:30*pm, Helmut Tessarek <tessa... (AT) evermeet (DOT) cx> wrote:
Quote:
Hi Wendy,

What am I missing here? *Does db2expln not populate the explain
tables ... or am I doing something wrong?

You are correct, db2expln does not populate the explain tables.

Furthermore the output of db2exfmt has more detailed optimizer information.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab
Ok, thanks. I was under the impression that in order to get the plan/
optimizer info, I would run db2expln then db2exfmt --- seems
reasonable -- explain then format the explain?

Thanks for the response.

Wendy

Reply With Quote
  #4  
Old   
Helmut Tessarek
 
Posts: n/a

Default Re: db2expln vs explain plan - 12-01-2011 , 10:49 AM



Hi Wendy,

On 12/01/2011 09:23 AM, Wendy wrote:
Quote:
Ok, thanks. I was under the impression that in order to get the plan/
optimizer info, I would run db2expln then db2exfmt --- seems
reasonable -- explain then format the explain?
db2expln is rather a quick and dirty method of getting a plan and
optimizer info. At least that's the way I always saw it. db2expln takes
your statement or input file and gives you the output in one step. The
optimizer info is not too detailed but is definitely good enough for a
first glance at the access plan.

If you want more detailed information or want to drill down into the
depths of optimizer info, you will have to use db2 explain.
You can use the CURRENT EXPLAIN MODE special register to control the
behavior of the explain command. - http://j.mp/vKUf7W
After you have collected the data, you can format the data by using
db2exfmt.

Please be aware that db2exfmt will give you all the data you ever wanted
- and more (it will also give you all the data you do not want to
know... :-)

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab

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.