Re: What does "merge-joinable join conditions" mean ???? - Mailing list pgsql-sql

From Tom Lane
Subject Re: What does "merge-joinable join conditions" mean ????
Date
Msg-id 17223.1137363596@sss.pgh.pa.us
Whole thread Raw
In response to Re: What does "merge-joinable join conditions" mean ????  (Michael Fuhr <mike@fuhr.org>)
List pgsql-sql
Michael Fuhr <mike@fuhr.org> writes:
> The 8.0.5 Release Notes have the following item, but without seeing
> your query it's hard to know whether this fix is relevant to your
> problem (the fix mentions RIGHT JOIN; your error says FULL JOIN):

Good catch, but that bug was specific to left/right joins (basically,
the code failed to force the join to be flipped around when needed).
With a FULL JOIN you're stuck ... flipping it doesn't help.

The reason it's an issue is that for a FULL JOIN, the executor has to
keep track of whether rows on *both* sides of the join have been matched
to any rows of the other side.  If there are join conditions that are
outside the mergejoin list then this requires an indefinitely large
amount of state.

It'd be possible to teach hash join to implement FULL JOIN (basically,
you'd have to add an I've-been-joined flag to each entry in the hash
table, and then re-scan the hash table at the end of the join to see
which inner-side rows remain unjoined).  With this you'd only need one
hashable join condition to make it work, whereas the FULL JOIN mergejoin
code requires *all* the join conditions to be mergejoinable.  The issue
hasn't come up often enough to make it seem like a high-priority
problem, however.  I can only recall one or two people complaining about
it in all the time we've had outer-join support.
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: What does "merge-joinable join conditions" mean ????
Next
From: "Dean Gibson (DB Administrator)"
Date:
Subject: Re: What does "merge-joinable join conditions" mean ????