Skip site navigation (1) Skip section navigation (2)

Re: Optimizing Outer Joins

From: Sebastian Böck <sebastianboeck(at)freenet(dot)de>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimizing Outer Joins
Date: 2005-01-28 12:30:29
Message-ID: 41FA3065.70003@freenet.de (view raw or flat)
Thread:
Lists: pgsql-performance
Richard Huxton wrote:
> Sebastian Böck wrote:
>> But why is the scan on table b performed?
>> If i understand it correctly this is unnecessary because the
>> result contains only rows from table a.
> 
> 
> It's only unnecessary in the case where there is a 1:1 correspondence 
> between a.id and b.id - if you had more than one matching row in "b" 
> then there'd be repeated rows from "a" in the result. Not sure if PG can 
>  tell what the situation is regarding references and pkeys, but in your 
> example you don't have one anyway.

Ok, is there a way to avoid the extra scan if only one row is
returned (distinc on for example)?

What would be great is if a subselect could work with more than
one column returning. Is there a way to achieve this?

Thanks Sebastian


In response to

pgsql-performance by date

Next:From: Alexandre LeclercDate: 2005-01-28 14:25:55
Subject: Re: Flattening a kind of 'dynamic' table
Previous:From: Dawid KuroczkoDate: 2005-01-28 08:07:59
Subject: Re: Flattening a kind of 'dynamic' table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group