Re: Convert IN sublink to join - Mailing list pgsql-performance

From Tom Lane
Subject Re: Convert IN sublink to join
Date
Msg-id 19522.1134574013@sss.pgh.pa.us
Whole thread Raw
In response to Convert IN sublink to join  (<francisco.santos@tagus.ist.utl.pt>)
List pgsql-performance
<francisco.santos@tagus.ist.utl.pt> writes:
>       /*
>        * The sub-select must not refer to any Vars of the parent query.
>        * (Vars of higher levels should be okay, though.)
>        */
>       if (contain_vars_of_level((Node *) subselect, 1))
>               return NULL;

> By commenting this code region I was able to optimize several correlated
> subqueries.

It's only pure luck that your test case still produces the right answer.
The IN code depends on the assumption that the sub-SELECT is independent
of the outer query.

            regards, tom lane

pgsql-performance by date:

Previous
From:
Date:
Subject: Convert IN sublink to join
Next
From: Andrew Rawnsley
Date:
Subject: Re: SAN/NAS options