pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: francisco.santos@tagus.ist.utl.pt
Cc: pgsql-performance@postgresql.org
Subject: Re: Convert IN sublink to join
Date: Wed, 14 Dec 2005 10:26:53 -0500
Message-ID: <19522.1134574013@sss.pgh.pa.us> (raw)
In-Reply-To: <000001c600b2$1ccb44e0$017ba8c0@flintstone>
References: <000001c600b2$1ccb44e0$017ba8c0@flintstone>

<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



view thread (2+ messages)

Message-ID: <19522.1134574013@sss.pgh.pa.us>
Permalink:  ../19522.1134574013@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19522.1134574013@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, francisco.santos@tagus.ist.utl.pt
  Subject: Re: Convert IN sublink to join
  In-Reply-To: <19522.1134574013@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox