Re: [HACKERS] Idea for speeding up uncorrelated subqueries - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Date
Msg-id 4838.933869445@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Idea for speeding up uncorrelated subqueries  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [HACKERS] Idea for speeding up uncorrelated subqueries
List pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:
>> Bruce Momjian <maillist@candle.pha.pa.us> writes:
>>>> Yes, the subqueries need work.  We don't even do index lookups into the
>>>> inner plan, only sequential.  Already on TODO.
>> 
>> Huh?  I don't follow that at all...

> Suppose you have a subquery that returns 1000 rows.  There is no code so
> lookups of the inner table are indexed:

>     select *
>     from tab
>     where col in (select col2 from tab2)

> In this case, a sequential scan of the subquery results are required.

Well, yes, the subquery is a sequential scan.  I guess what you are
envisioning is rewriting this into some kind of nested-loop join?
For simple cases that might be possible...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Idea for speeding up uncorrelated subqueries