Re: left join query does not perform well - Mailing list pgsql-sql

From Tom Lane
Subject Re: left join query does not perform well
Date
Msg-id 5882.1030288343@sss.pgh.pa.us
Whole thread Raw
In response to left join query does not perform well  (Manuel Sugawara <masm@fciencias.unam.mx>)
List pgsql-sql
Manuel Sugawara <masm@fciencias.unam.mx> writes:
> Ouch, 3117.48 msec vs. 1.15 msec is a huge difference. I need
> something else? or may be postgres optimizer can't cope with
> left/right joins?

I think the problem is you're constraining the join order into a very
inefficient one.  See

http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/explicit-joins.html

But it's difficult to be sure, when you are showing us EXPLAIN output
that manifestly doesn't correspond to what you say the queries are.
For instance the nearest match to "epr_vord_grupo AS grupo" in the
explain output is "epr_ord_grupo g" ... I'm also wondering if any of
the tables used in the queries are really views, and if so what the
view definitions are.
        regards, tom lane


pgsql-sql by date:

Previous
From: "Michael Paesold"
Date:
Subject: Re: weird situation, BUG or I'm not doing it right
Next
From: Tom Lane
Date:
Subject: Re: weird situation, BUG or I'm not doing it right