Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group