Re: join removal

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, "<pgsql-hackers(at)postgresql(dot)org>" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: join removal
Date: 2009-07-20 04:22:43
Message-ID: 18697.1248063763@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Sun, Jul 19, 2009 at 10:56 PM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I think we want something along the lines of relation_is_distinct_for
>> with a list of columns and a list of comparison operators, where the
>> first-cut implementation will be to look for matching indexes.

> That seems reasonable; my problem is (and I'm sorry if I'm being dense
> here) where am I going to get the list of columns and the list of
> comparison operators? add_paths_to_joinrel() just gets a list of
> RestrictInfos for the join clauses, and I don't know what to do with
> that.

You'd need to pull apart the clauses inside the RestrictInfos, ie look
to see if they have the form "outer.col op inner.col" and then grab the
op and the inner.col. Some of this is already done for you: you can
look at the RestrictInfo to see if it's an operator clause and which
side of the clause belongs to the relation you're interested in.
This isn't a whole lot different from what's done to extract hash or
merge join clauses from the list of join RestrictInfos.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Kerr 2009-07-20 05:33:15 [PATCH v4] Avoid manual shift-and-test logic in AllocSetFreeIndex
Previous Message Robert Haas 2009-07-20 03:58:34 Re: join removal