Re: LATERAL - Mailing list pgsql-hackers

From Greg Stark
Subject Re: LATERAL
Date
Msg-id 407d949e0910191339n26b0adc9xf2e2b680eb8e4bcc@mail.gmail.com
Whole thread Raw
In response to Re: LATERAL  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LATERAL
Re: LATERAL
List pgsql-hackers
On Sun, Oct 18, 2009 at 12:57 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> You could probably convince me that a merge join is not going to be
>> too useful (how often can you want a merge join on the inner side of a
>> nested loop?
>
> Why not?  As Andrew pointed out, what we're really trying to accomplish
> here is consider sub-join plans that are parameterized by a value
> obtained from an outer relation.  I think we shouldn't artificially
> limit what we consider.

Am I understanding you right that a typical case of this might be something like

nested loop   index scan expecting 1 record   merge join       index scan on partial index where col = outer.foo and
col2
between a and b       some other scan

or

nested loop   index scan expecting 1 record   merge join       index scan on <col1,col2> where col1 = outer.foo and
col2
between a and b       some other scan

Ie, where the nested loop is a degenerate nested loop which only
expects a single value and provides a parameter which allows some
partial index to work or allows for some other index scan by providing
a higher order key element?

--
greg


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Application name patch - v2
Next
From: "Eric B. Ridge"
Date:
Subject: Re: Controlling changes in plpgsql variable resolution