Re: Any way to Convince postgres to push join clause inside subquery aggregate?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Any way to Convince postgres to push join clause inside subquery aggregate?
Date: 2003-09-02 17:46:13
Message-ID: 87ptijdqxm.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Greg Stark <gsstark(at)mit(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-09-02 17:46:15 Re: Table name lengths...
Previous Message Tom Lane 2003-09-02 17:42:10 Re: Table name lengths...