On Wed, 9 Nov 2005, Ashok Agrawal wrote: > I noticed outer join is very very slow in postgresql as compared > to Oracle. > > SELECT a.dln_code, a.company_name, > to_char(a.certificate_date,'DD-MON-YYYY'), > to_char(a.certificate_type_id, '99'), > COALESCE(b.certificate_type_description,'None') , > a.description, a.blanket_single, a.certificate_status, > COALESCE(a.sun_legal_entity, 'None'), > COALESCE(a.other_entity_name, 'None'), > COALESCE(a.notes, 'None'),COALESCE(c.name, NULL), > COALESCE(to_char(a.created_date,'DD-MON-YYYY'), 'N/A'), > COALESCE(c.name, NULL), > COALESCE(to_char(a.updated_date,'DD-MON-YYYY'), 'N/A'), > COALESCE(e.name, NULL), > COALESCE(to_char(a.approved_date,'DD-MON-YYYY'), 'N/A') > FROM ((((ecms_cert_headers a > LEFT OUTER JOIN taxpack_user c ON (a.created_by = c.emp_no)) > LEFT OUTER JOIN taxpack_user d ON (a.updated_by = d.emp_no)) > LEFT OUTER JOIN taxpack_user e ON (a.approved_by = e.emp_no)) > INNER JOIN ecms_certificate_types b ON > (a.certificate_type_id= b.certificate_type_id )) > WHERE a.dln_code = '17319' I think in the above it's safe to do the inner join first, although PostgreSQL won't determine that currently and that could have something to do with the difference in performance if Oracle did reorder the joins. If you were to run the query doing the INNER JOIN first, does that give the correct results and run more quickly in PostgreSQL? In either case, explain analyze output would be handy to find the actual times taken by the steps. ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster