Re: [HACKERS] Idea for speeding up uncorrelated subqueries

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: "Ansley, Michael" <Michael(dot)Ansley(at)intec(dot)co(dot)za>
Cc: "'Bruce Momjian'" <maillist(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Date: 1999-08-06 08:12:59
Message-ID: 37AA990B.E116CDC2@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Ansley, Michael" wrote:
>
> I thought that all correlated and uncorrelated sub-queries could be
> rewritten as a join, simplifying the query tree. It should be a mechanical
> process which can probably be performed in the rewriter.

IN can't be rewritten as a join! Subquery may return duplicates
and join would return tuple for all of them.

And how about WHERE x = (select max(y) from ...) ?

And even for WHERE x = (select y from ...) we have to check
that subquery returns exactly ONE row, or abort.

Vadim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-08-06 08:25:22 [PHP3] mysql is case sensitive? (fwd)
Previous Message Ansley, Michael 1999-08-06 07:58:00 RE: [HACKERS] Idea for speeding up uncorrelated subqueries