Skip site navigation (1) Skip section navigation (2)

Re: Query plan for NOT IN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Wakeling <matthew(at)flymine(dot)org>
Cc: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Query plan for NOT IN
Date: 2009-10-05 14:30:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Matthew Wakeling <matthew(at)flymine(dot)org> writes:
> Yes, that does work, but only because id is NOT NULL. I thought Postgres 
> 8.4 had had a load of these join types unified to make it less important 
> how the query is written?

NOT IN is not easily optimizable because of its odd behavior in the
presence of nulls.  Use NOT EXISTS instead, or that left join hack.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Stefan KaltenbrunnerDate: 2009-10-05 14:55:15
Subject: Re: Best suiting OS
Previous:From: Grzegorz JaśkiewiczDate: 2009-10-05 14:06:41
Subject: Re: Query plan for NOT IN

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group