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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-performance by date

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