Learnings

Tuesday, July 22, 2008

DB2 Explain Plan

On LUW, it is possible to explain a statement using the syntax "EXPLAIN PLAN FOR ". This actually fills in a lot of information about the statement into no less than 7 tables (EXPLAIN_INSTANCE, EXPLAIN_STATEMENT, EXPLAIN_STREAM,EXPLAIN_OBJECT,EXPLAIN_OPERATOR,EXPLAIN_PREDICATE and EXPLAIN_ARGUMENT). While there is bound to be a wealth of info in these tables, one thing in particular is very useful: the EXPLAIN_STATEMENT table will have both the query submitted by the user and also the internally re-written query by DB2! This can be really useful in debugging and can also teach a few things about how to write efficient queries.
z/OS has something similar although it only writes into 3 tables, one of which has detailed info about function calls.

Labels: , ,

0 Comments:

Post a Comment

<< Home