From: Sebastian Böck <sebastianboeck@freenet.de>
To: Richard Huxton <dev@archonet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimizing Outer Joins
Date: Fri, 28 Jan 2005 13:30:29 +0100
Message-ID: <41FA3065.70003@freenet.de> (raw)
In-Reply-To: <41F8BFFB.5020605@archonet.com>
References: <41F8A41A.5020301@freenet.de>
<41F8BFFB.5020605@archonet.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: sebastianboeck@freenet.de, dev@archonet.com
Subject: Re: Optimizing Outer Joins
In-Reply-To: <41FA3065.70003@freenet.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox