Re: Any way to Convince postgres to push join clause inside subquery aggregate? - Mailing list pgsql-general

From Greg Stark
Subject Re: Any way to Convince postgres to push join clause inside subquery aggregate?
Date
Msg-id 87ptijdqxm.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: Any way to Convince postgres to push join clause inside subquery aggregate?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Greg Stark <gsstark@mit.edu> writes:
> > slo=> explain
> > select *
> >  from (select foo_id,count(*) as n from foo_bar group by foo_id) as x
> >  join (select * from foo limit 1) as foo using (foo_id)
> > ;
>
> Why not put the subselect in the output list, if that's the kind of plan
> you want?

Actually that's the way the query is right now. The problem arises because I
want to add a second column without duplicating the whole thing.

--
greg

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Table name lengths...
Next
From: Tom Lane
Date:
Subject: Re: Table name lengths...