Re: Eliminating unnecessary left joins

From: "Zeugswetter Andreas ADI SD" <ZeugswetterA(at)spardat(dot)at>
To: Ottó Havasvölgyi <havasvolgyi(dot)otto(at)gmail(dot)com>, "Jim Nasby" <decibel(at)decibel(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Eliminating unnecessary left joins
Date: 2007-04-12 09:49:21
Message-ID: E1539E0ED7043848906A8FF995BDA57901E7BD3F@m0143.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> Maybe odd, but simpler to optimize this way.
>
> Your idea would be also a very good optimization, there was
> already a discussion about that here:
> http://archives.postgresql.org/pgsql-performance/2006-01/msg00
> 151.php, but that time Tom refused it because it was too
> expensive and rare. Maybe now he has a different opinion.
> However, left join optimization is lot simpler and cheaper,
> and can be useful not only for O/R mappers, but for efficient
> vertical partitioning as Simon mentioned.

For the views use case there is a simple solution without the expensive optimization:
If you have a PK FK relationship simply rewrite the view to use a left join instead
of a join. Since there is always one row on the outer (PK) side it makes no difference to the result set.
And then the left join optimization can be used.

Andreas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2007-04-12 10:11:18 Re: Vista/IPv6
Previous Message Ottó Havasvölgyi 2007-04-12 09:18:00 Re: Eliminating unnecessary left joins