Link to home
Start Free TrialLog in
Avatar of bibi92
bibi92Flag for France

asked on

optimize sql statement

Hello,

How can I optimize this query :
select DAA.ZORIDOS_0,'DAA-', DAA.CPY_0, sum(DAA.AMTCUR_0*DAE.SNS_0)
from ODS1.GACCENTRYA DAA,
     ODS1.GACCENTRYD DAE,
     ODS1.GACCENTRY  HAE
where DAE.ZORIDOS_0=DAA.ZORIDOS_0
and   DAE.TYP_0=DAA.TYP_0
and   DAE.NUM_0=DAA.NUM_0
and   DAE.LIG_0=DAA.LIG_0
and   DAE.SNS_0=-1
and   HAE.ZORIDOS_0=DAE.ZORIDOS_0
and   HAE.TYP_0=DAA.TYP_0
and   HAE.NUM_0=DAA.NUM_0
group by DAA.ZORIDOS_0,DAA.CPY_0

The cost of join between GACCENTRYA et GACCENTRYD is very high.

Thanks

Regards

bibi
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bibi92

ASKER

Thanks bibi