On Sat, Jul 21, 2012 at 6:52 AM, Alban Hertroys <haramrae@xxxxxxxxx> wrote: > I don't think the DISTINCT is necessary there, doesn't EXCEPT already return a distinct set, just like UNION (hence the existence of UNION ALL)? > > It can also be written as a correlated subquery: Oops, yes. I usually use UNION ALL and friends, and IMHO that "ALL" keyword is one of SQL's weirder warts. Most of the time, a wordier query involves more work (SELECT DISTINCT vs SELECT), but in this odd instance, it's the other way around. And yes, it can. Not sure whether the subquery or EXCEPT notation is more readable. Much of a muchness, really. ChrisA -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general