Re: EXCEPT performace

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "K(dot) Ari Krupnikov" <ari(at)cogsci(dot)ed(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: EXCEPT performace
Date: 2001-11-05 17:57:04
Message-ID: 23047.1004983024@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"K. Ari Krupnikov" <ari(at)cogsci(dot)ed(dot)ac(dot)uk> writes:
> I noticed an unexpected difference in performance between seemingly equivalent queries:
> SELECT id FROM short_table EXCEPT SELECT id FROM long_table;

> and

> SELECT id FROM short_table EXCEPT
> (SELECT id FROM short_table JOIN long_table
> ON short_table.id = long_table.id);

But they're not equivalent. Consider what happens when NULLs are
present in both tables.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2001-11-05 17:57:09 Re: Use of Serial Datatype and Sequence Issue
Previous Message Johnny Jrgensen 2001-11-05 17:54:33 Re: Function problems redux