Re: [HACKERS] Idea for speeding up uncorrelated subqueries

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Vadim Mikheev <vadim(at)krs(dot)ru>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Date: 1999-08-05 16:17:50
Message-ID: 199908051617.MAA29512@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)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...

Yes, or mergejoin/hashjoin.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 1999-08-05 17:30:25 Re: PG 6.5.1 RPMS
Previous Message Tom Lane 1999-08-05 16:10:45 Re: [HACKERS] Idea for speeding up uncorrelated subqueries