Re: What does "merge-joinable join conditions" mean ????

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: "Dean Gibson (DB Administrator)" <postgresql4(at)ultimeth(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: What does "merge-joinable join conditions" mean ????
Date: 2006-01-15 22:19:56
Message-ID: 17223.1137363596@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael Fuhr <mike(at)fuhr(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dean Gibson (DB Administrator) 2006-01-15 22:28:08 Re: What does "merge-joinable join conditions" mean ????
Previous Message Tom Lane 2006-01-15 21:58:28 Re: What does "merge-joinable join conditions" mean ????