From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: List pgsql-patches <pgsql-patches@postgresql.org>
Subject: Re: WIP Join Removal
Date: Tue, 02 Sep 2008 13:18:37 -0400
Message-ID: <16037.1220375917@sss.pgh.pa.us> (raw)
In-Reply-To: <1220375620.4371.479.camel@ebony.2ndQuadrant>
References: <1220176372.4371.118.camel@ebony.2ndQuadrant>
<15179.1220372890@sss.pgh.pa.us>
<1220375620.4371.479.camel@ebony.2ndQuadrant>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-patches@postgresql.org
Cc: tgl@sss.pgh.pa.us, simon@2ndQuadrant.com
Subject: Re: WIP Join Removal
In-Reply-To: <16037.1220375917@sss.pgh.pa.us>
References: <1220176372.4371.118.camel@ebony.2ndQuadrant> <15179.1220372890@sss.pgh.pa.us> <1220375620.4371.479.camel@ebony.2ndQuadrant> <16037.1220375917@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox