Re: Optimization rules for semi and anti joins

From: Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimization rules for semi and anti joins
Date: 2009-02-11 17:43:18
Message-ID: 831948C5-D718-429D-9A64-204EEA6EE575@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11 Feb 2009, at 00:03, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Actually, that makes less sense than the antijoin case. For antijoin
> there is a well-defined value for the extended columns, ie null. For
> a semijoin the RHS values might come from any of the rows that happen
> to join to the current LHS row, so I'm just as happy that it's
> syntactically impossible to reference them.

Actually I think the way mysql users used to spell EXISTS/IN before
mysql supported them would qualify as a semijoin where you can access
the columns:

SELECT distinct a.* from a,b WHERE a.id = b.id

To access columns from b in postgres you would have to use DISTINCT ON.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2009-02-11 17:59:22 Re: temporarily stop autovacuum
Previous Message Tom Lane 2009-02-11 17:34:25 Re: Re: [COMMITTERS] pgsql: Update autovacuum to use reloptions instead of a system catalog,