Re: Convert IN sublink to join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: francisco(dot)santos(at)tagus(dot)ist(dot)utl(dot)pt
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Convert IN sublink to join
Date: 2005-12-14 15:26:53
Message-ID: 19522.1134574013@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

<francisco(dot)santos(at)tagus(dot)ist(dot)utl(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andrew Rawnsley 2005-12-14 16:53:52 Re: SAN/NAS options
Previous Message John Sidney-Woollett 2005-12-14 13:52:00 Re: Memory Leakage Problem