thanks for your response, can you send me using JOINS, for the below query
SELECT DISTINCT SCANOSEC.I_LOAN_ACCOUNT.I_CLOSING_DATE,SCANOSEC.I_ APP_RELATIONSHIP.I_APP_ID
FROM SCANOSEC.I_APPLICATION,SCANOSEC.I_APP_RELATIONSHIP ,SCANOSEC.I_LOAN_ACCOUNT
WHERE SCANOSEC.I_APPLICATION.I_JOINT_STATUS = 200
AND SCANOSEC.I_APPLICATION.I_APP_ID=SCANOSEC.I_APP_REL ATIONSHIP.I_LINKED_APP_ID
AND SCANOSEC.I_APPLICATION.I_APP_ID=SCANOSEC.I_LOAN_AC COUNT.I_APP_ID
AND SCANOSEC.I_APP_RELATIONSHIP.I_LINK_TYPE=2
AND SCANOSEC.I_LOAN_ACCOUNT.I_CLOSING_DATE = '2009-11-25 00:00:00';
-----------------------------------------------------------------------------
Quote:
|
Originally Posted by stolze
The order of conditions is completely irrelevant. The DB2 optimizer will choose the execution order for predicates as it seems best. Also, it is completely irrelevant for the optimizer whether join conditions are written in the ON clause of the explicit join syntax or in the WHERE clause with implicit joins. (Personally, I prefer the explicit join syntax because it is easier to read and to separate join conditions from other filter predicates.) So you can ignore ani_dbforum's statements right away.
What should be done here is:
(a) make sure that the query is exactly what the application needs and not too much (e.g. is the DISTINCT necessary?)
(b) verify that the necessary indexes exist
(c) ensure that statistics were collected on tables and indexes
You could also run this query as workload through the DB2 design advisor. Maybe there are some other objects like MQTs that could improve the situation.
|