Re: join removal - Mailing list pgsql-hackers

From Robert Haas
Subject Re: join removal
Date
Msg-id 603c8f070908272023x549f9deeib5fc2170e0a7752a@mail.gmail.com
Whole thread Raw
In response to Re: join removal  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Sun, Aug 16, 2009 at 5:31 PM, Robert Haas<robertmhaas@gmail.com> wrote:
> It seems that the needed checks are very similar to the ones that we
> already implement when setting restrictinfo->mergeopfamilies.  That is
> filled in by get_mergejoin_opfamilies(), which checks for btree
> opfamilies where the strategy number is BTEqualStrategyNumber.  This
> might cease to be the correct check in the (not-too-distant?) future
> if we end up implementing other kinds of unique indices, but right now
> btrees are all there is.
>
> One possibility would be to have relation_is_distinct_for() call
> get_mergejoin_opfamilies() for each operator; then for each index we
> can check whether the opfamily of the relevant index column is in the
> returned list.  This seems a bit wasteful, though, since I believe
> that relation_is_distinct_for() would be called from joinpath.c, which
> has access to restrictinfo->mergeopfamilies already.
>
> I'm wondering whether it would make more sense to modify the proposed
> API for relation_is_distinct_for() in some way so that we don't lose
> this information.

Here is an attempt at the latter approach.  This doesn't actually
remove the join yet; it just checks whether the join can be removed.
I haven't tested it extensively yet, but am hoping for some feedback
on the basic approach.

...Robert

Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: patch: Review handling of MOVE and FETCH (ToDo)
Next
From: Ron Mayer
Date:
Subject: Re: 8.5 release timetable, again