Outer Join is very very slow [message #285822] |
Wed, 05 December 2007 15:22 |
klkoona
Messages: 1 Registered: December 2007 Location: USA
|
Junior Member |
|
|
Hi,
I have been trying to execute the following query using TOAD/SQL plus. I am getting terrible performence. Since I am quite new to this SQL environment, I couldn't figure it out problem with either data base side ( no proper indexes etc) or SQL. Please review the sql and suggest me to improve it.
SQL:
select a.ab_nbr, from can_sal_summ a
left outer join coo_msg b
on
to_char(ab_create_dt_tm,'mm/yyyy') = to_char(add_months(sysdate,-1), 'mm/yyyy')
and
to_char(msg_rcv_gmt,'yyyymm') >= to_char(add_months(sysdate,-1),'yyyymm')
and to_char(msg_rcv_gmt,'yyyymm') <= to_char(add_months(sysdate,-0),'yyyymm')
and msg_type = 'FAA'
and dup_ind = 'N'
and a.prod_type not in ('AB', 'CA')
AND a.HSURR_ID = '*'
AND a.comdty_desc not like '%CLOTH%' AND a.COMDTY_DESC not LIKE 'COMAT'
and a.shipper_nm not like 'CALI%'
and a.shipper_nm not like 'ILLI%'
******************************************************
|
|
|
|
|