Re: Planning for improved versions of IN/NOT IN

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Planning for improved versions of IN/NOT IN
Date: 2002-11-30 04:42:29
Message-ID: 3DE841B5.1010401@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway wrote:
> Tom Lane wrote:
>
>> I've been thinking about how to improve the performance of queries using
>> "WHERE x IN (subselect)" and "WHERE x NOT IN (subselect)".
>
> How about starting with a rule-based method to make the choice?
>
> 1. If uncorrelated: use hash-based approach - ISTM this might address a
> large
> percentage of the problem cases -- it could even handle the
> "IN (list-of-scalars)" case. Could it fall back to a
> tuplesort/binary-search for the too many to hash in memory case?
> 2. If correlated: use an inner indexscan
> 3. If you come up with a pattern where none of the approaches produce a
> correct answer, use the existing implementation
>
> You could always get fancier later if needed, but something along these
> lines would be a great start.

I curious if any of the rewriting of EXISTS and NOT EXISTS would
address the problem described by Date:

http://www.firstsql.com/iexist.htm

Mike Mascari
mascarm(at)mascari(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-11-30 05:44:59 Re: Planning for improved versions of IN/NOT IN
Previous Message Justin Clift 2002-11-30 04:32:54 Re: Postgres 7.3 announcement on postgresql.org