| 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 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexandre Leclerc | 2005-01-28 14:25:55 | Re: Flattening a kind of 'dynamic' table |
| Previous Message | Dawid Kuroczko | 2005-01-28 08:07:59 | Re: Flattening a kind of 'dynamic' table |