Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005

    Question Unanswered: 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

  2. #2
    Join Date
    Oct 2005
    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 ?

  3. #3
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts