Re: IN surpasses NOT EXISTS in 7.4RC2 ??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: IN surpasses NOT EXISTS in 7.4RC2 ??
Date: 2003-11-13 15:19:51
Message-ID: 26331.1068736791@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Rajesh Kumar Mallah <mallah(at)trade-india(dot)com> writes:
> NOT EXISTS is taking almost double time than NOT IN .
> I know IN has been optimised in 7.4 but is anything
> wrong with the NOT EXISTS?

That's the expected behavior in 7.4. EXISTS in the style you are using
it effectively forces a nestloop-with-inner-indexscan implementation.
As of 7.4, IN can do that, but it can do several other things too,
including the hash-type plan you have here. So assuming that the
planner chooses the right plan choice (not always a given ;-))
IN should be as fast or faster than EXISTS in all cases.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Treat 2003-11-13 15:31:42 Re: IN surpasses NOT EXISTS in 7.4RC2 ??
Previous Message Bruce Momjian 2003-11-13 14:56:57 Re: IN surpasses NOT EXISTS in 7.4RC2 ??