Re: Strange plan in pg 8.1.0 - Mailing list pgsql-performance

From Tom Lane
Subject Re: Strange plan in pg 8.1.0
Date
Msg-id 16059.1162220969@sss.pgh.pa.us
Whole thread Raw
In response to Strange plan in pg 8.1.0  (Mattias Kregert <mattias@kregert.se>)
List pgsql-performance
Mattias Kregert <mattias@kregert.se> writes:
> Why does it come up with this strange plan?

Because 8.1 can't reorder outer joins.  To devise the plan you want,
the planner has to be able to prove that it's OK to perform the IN join
before the LEFT join, something that isn't always the case.  8.2 can
prove this, but no existing release can.

The only workaround I can think of is to do the IN in a sub-select.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Mattias Kregert"
Date:
Subject: Re: Strange plan in pg 8.1.0
Next
From: "Luke Lonergan"
Date:
Subject: Re: Best COPY Performance