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 > understanding explain tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-16-05, 14:28
fede_ff fede_ff is offline
Registered User
 
Join Date: Jul 2005
Posts: 7
Question understanding explain tables

Hi everyone. Im trying to write a program that executes queries in batch mode. The queries are given by users. The program must be able to know (aprox.) how many resources the query will use in order to:

1) Discard those queries that will consume too much resources (specially time)
2)Order the request so that the "lightest" queries are executed first

I think that the "EXPLAIN" command could help me to do this, but Im having problems interpreting the data contained in the EXPLAIN_* tables. Do you know any doc that explains how to query the EXPLAIN tables and also explains how to read the results?

Thanks a lot
Federico
Reply With Quote
  #2 (permalink)  
Old 11-17-05, 03:54
juliane26 juliane26 is offline
Registered User
 
Join Date: Oct 2005
Posts: 109
Why do you try to explain the EXPLAIN tables yourself?

Use the GUI or ASCII tools to do that for you:
GUI: In the Control Center select database -> explain SQL / Explained statement history
ASCII: use db2exfmt utility to read your access path and cost.

BTW: if you are on z/OS, there is now also Visual Explain available for free.
Go have a look.

If you just want the overall estimated cost, then use TOTAL_COST from EXPLAIN_STATEMENT table in LUW.

Or are you on z/OS ?
__________________
Juliane
Reply With Quote
  #3 (permalink)  
Old 11-17-05, 09:02
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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