Re: WIP Join Removal

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: WIP Join Removal
Date: 2008-09-02 17:18:37
Message-ID: 16037.1220375917@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Simon Riggs <simon(at)2ndQuadrant(dot)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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message David Rowley 2008-09-02 23:19:26 Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)
Previous Message Simon Riggs 2008-09-02 17:13:40 Re: WIP Join Removal