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

Re: EXISTS vs IN vs OUTER JOINS

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: jasiek(at)klaster(dot)net,PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>
Subject: Re: EXISTS vs IN vs OUTER JOINS
Date: 2002-12-20 08:53:56
Message-ID: 53m50vohh8v0asvmb425e9lplphvb1m6b1@4ax.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Thu, 19 Dec 2002 15:19:21 -0800, "Josh Berkus" <josh(at)agliodbs(dot)com>
wrote:
>SELECT t1.* 
>FROM table1 t1
>  LEFT JOIN table2 t2 ON t1.xid = t2.xid
>WHERE t2.label IS NULL

Josh, also note that Tomasz did something like

SELECT t1.* 
FROM table1 t1
  LEFT JOIN table2 t2 ON t1.xid = t2.xid
WHERE t2.xid IS NULL
         ^^^
This special trick guarantees that you get exactly the rows from t1
not having a matching row in t2, because a NULL xid in t2 would not
satisfy the condition t1.xid = t2.xid.

Servus
 Manfred

In response to

pgsql-performance by date

Next:From: Manfred KoizarDate: 2002-12-20 10:27:18
Subject: Re: 4G row table?
Previous:From: Tom LaneDate: 2002-12-20 00:02:13
Subject: Re: EXISTS vs IN vs OUTER JOINS

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