Re: WIP Join Removal - Mailing list pgsql-patches

From Tom Lane
Subject Re: WIP Join Removal
Date
Msg-id 16037.1220375917@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP Join Removal  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-patches
Simon Riggs <simon@2ndQuadrant.com> writes:
> On Tue, 2008-09-02 at 12:28 -0400, Tom Lane wrote:
>> 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.

That conclusion seems utterly wrong to me.  Per the example of

a left join b on (a.x = b.y and b.z = 1)

b.z = 1 will bubble down to be a qual on b.  It doesn't prevent the join
optimization, and it does possibly allow the use of a partial index.
In particular a unique index on b.y with a predicate involving b.z would
be relevant to the optimization decision here.

In slightly more realistic cases, b might be a view on c that imposes
a WHERE condition on c.z, so that's another avenue for a qual to exist
below the join.

            regards, tom lane

pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Re: WIP Join Removal
Next
From: "David Rowley"
Date:
Subject: Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)