The i5/OS™ distributed query optimizer provides you with information messages on the current query processing when the job is in debug mode.
These messages, which show how the distributed query was processed, are in addition to the existing optimizer messages. These messages appear for the Open Query File (OPNQRYF) command, DB2® UDB Query Manager and SQL Development Kit, interactive SQL, embedded SQL, and in any iSeries™ server high-level language (HLL). Every message appears in the job log; you only need to put your job into debug mode.
You can evaluate the performance of your distributed query by using the informational messages put in the job log by the database manager. The database manager can send any of the following distributed messages or existing optimizer messages when appropriate. The ampersand variables (&1, &X) are replacement variables that contain either an object name or another substitution value when the message appears in the job log:
These messages provide feedback on how a distributed query was run and, in some cases, indicate the improvements that can be made to help the query run faster. The causes and user responses for the messages are paraphrased below. The actual message help is more complete and should be used when trying to determine the meaning and responses for each message.
A detailed explanation for each message follows:
This message indicates that a single distributed file was queried and was not processed in multiple steps. This message lists the nodes of the file where the query was run.
This message indicates that a distributed join occurred. This message also lists the nodes where the join was run as well as the files that were joined together.
This message indicates that a distributed query was processed in multiple steps and lists the current step number. Following this message are all the optimizer messages for that step.
This message indicates that a temporary distributed result file was created and lists a reason code as to why the temporary file was required. This message also shows the partitioning key that was used to create the file and the nodes that the temporary file was created on.
SQL: SELECT A.EMPNO, B.MGRNO, C.MGRNO, D.EMPNO FROM EMPLOYEE A, DEPARTMENT B, DEPARTMENT C, EMPLOYEE D WHERE A.EMPNO=B.MGRNO AND B.ADMRDEPT=C.DEPTNO AND C.DEPTNO=D.WORKDEPT OPNQRYF: OPNQRYF FILE((EMPLOYEE) (DEPARTMENT) (DEPARTMENT) (EMPLOYEE)) FORMAT(JFMT) JFLD((1/EMNO 2/MGRNO *EQ) (2/ADMRDEPT 3/DEPTNO) (3/DEPTNO 4/WORKDEPT))
The following list of distributed optimizer messages is generated:
File B was directed into temporary file *QQTDF0001.
Files B, C and *QQTDF0001 were joined. This was a combination of a collocated join (between files B and C) and a directed join (with file *QQTDF0001).
Temporary distributed file *QQTDF0002 was created to contain the result of joining files B, C and *QQTDF0001. This file was directed.
File A was directed into temporary file *QQTDF0003.
Files *QQTDF0002 and *QQTDF0003 were joined. This was a repartitioned join, because both files were directed before the join occurred.
Additional tools that you might want to use when tuning queries for performance include the CL commands Print SQL Information (PRTSQLINF), which applies to SQL programs and packages, and Change Query Attributes (CHGQRYA).