On Tue, 2008-09-02 at 12:28 -0400, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > As discussed on 26 June, "Join Removal/Vertical Partitioning", here's a
> > patch to remove joins in certain circumstances.
>
> Some points not made in the thread so far:
Various comments accepted and agreed.
> > + * XXX Seems not worth searching partial indexes because those
> > + * are only usable with a appropriate restriction, so the
> > + * only way they could ever be usable is if there was a
> > + * restriction that exactly matched the index predicate,
> > + * which is possible but generally unlikely.
>
> I haven't thought this through entirely, but wouldn't a partial index be
> okay if it's marked predOK? You might be right that the case is
> unlikely, but if it's only one extra line to support it ...
As of now, its it is predOK then that implies there was a qual on the
checkrel so can't remove the join. So no need to check.
> > + if (removable &&
> > + joinrel->cheapest_total_path < keeprel->cheapest_total_path)
>
> This test on cheapest_total_path seems pretty wacko
and stuff below it definitely is, from upthread discussion.
Hang fire on more comments - its a short patch but needs a few thwacks
from the cluestick yet before next review.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support