From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Ashok Agrawal <Ashok(dot)Agrawal(at)Sun(dot)COM> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Outer Join performance in PostgreSQL |
Date: | 2005-11-09 22:47:22 |
Message-ID: | 20051109144311.B34905@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2005-11-09 23:07:52 | Re: Some help on buffers and other performance tricks |
Previous Message | Ron Peacetree | 2005-11-09 21:24:49 | Re: Some help on buffers and other performance tricks |