pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rajesh Kumar Mallah <mallah@trade-india.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: IN surpasses NOT EXISTS in 7.4RC2 ??
Date: Thu, 13 Nov 2003 10:19:51 -0500
Message-ID: <26331.1068736791@sss.pgh.pa.us> (raw)
In-Reply-To: <200311131323.39762.mallah@trade-india.com>
References: <200311131323.39762.mallah@trade-india.com>

Rajesh Kumar Mallah <mallah@trade-india.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



view thread (8+ messages)  latest in thread

Message-ID: <26331.1068736791@sss.pgh.pa.us>
Permalink:  ../26331.1068736791@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26331.1068736791@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, mallah@trade-india.com
  Subject: Re: IN surpasses NOT EXISTS in 7.4RC2 ??
  In-Reply-To: <26331.1068736791@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