Обсуждение: implementing outer joins

Поиск
Список
Период
Сортировка

implementing outer joins

От
Brett McCormick
Дата:
does anyone have any idea how difficult it would be to implement, and
perhaps point me in the right direction?

RE: [HACKERS] implementing outer joins

От
"Stupor Genius"
Дата:
>
> does anyone have any idea how difficult it would be to implement, and
> perhaps point me in the right direction?
>

I forget where, but there is a place in the code where the two values
of the join are compared to see whether the row qualifies.  Around
this spot there is a check for one of the values being null and if it
is, the function doesn't include the data.  Seems that modifying that
spot or using it as a basis for your code could be a quick start for
the left join.  The right could perhaps then be converted beforehand
in the optimizer to a left to be handled there.

But there's prolly a great and sane reason why this wouldn't work.

Haven't thought about the full outer join yet.  Don't have my machine
completely configured yet and it's hard to stay in to do that with it
being summer and all.

Later,
darrenk

Re: [HACKERS] implementing outer joins

От
Bruce Momjian
Дата:
>
> does anyone have any idea how difficult it would be to implement, and
> perhaps point me in the right direction?
>
>

Good question.  My guess is that you have to set a flag in the
RangeTblEntry for OUTER, and have this flag read by all the join
methods.  Most(all?) of them have an inner and outer loop.  I think
OUTER has to be in the outer part of the loop, and as you are spinning
through the outer loop, if you don't find any matches in the inner loop,
you output the outer loop with NULLs for the inner values.  Now if you
have only two tables joined, and they are both outer, I am not sure how
to handle that.

Check out the new backend "How PostgreSQL Processes a Query" for hints
on where to make changes.  (I have gotten no comments on the new
version.)  Also check out the Developers FAQ for ideas too.


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)