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

From Vadim Mikheev
Subject Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Date
Msg-id 37AA990B.E116CDC2@krs.ru
Whole thread Raw
In response to RE: [HACKERS] Idea for speeding up uncorrelated subqueries  ("Ansley, Michael" <Michael.Ansley@intec.co.za>)
List 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


pgsql-hackers by date:

Previous
From: "Ansley, Michael"
Date:
Subject: RE: [HACKERS] Idea for speeding up uncorrelated subqueries
Next
From: The Hermit Hacker
Date:
Subject: [PHP3] mysql is case sensitive? (fwd)