Re: LATERAL

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, David Fetter <david(at)fetter(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: LATERAL
Date: 2009-10-19 20:39:44
Message-ID: 407d949e0910191339n26b0adc9xf2e2b680eb8e4bcc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 18, 2009 at 12:57 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Eric B. Ridge 2009-10-19 21:01:07 Re: Controlling changes in plpgsql variable resolution
Previous Message Magnus Hagander 2009-10-19 20:34:57 Re: Application name patch - v2