Re: join to view over custom aggregate seems like it should be faster - Mailing list pgsql-performance

From Merlin Moncure
Subject Re: join to view over custom aggregate seems like it should be faster
Date
Msg-id b42b73150704101053x297e5cb3kfe81b8979dad3002@mail.gmail.com
Whole thread Raw
In response to Re: join to view over custom aggregate seems like it should be faster  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: join to view over custom aggregate seems like it should be faster
List pgsql-performance
On 4/10/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Merlin Moncure" <mmoncure@gmail.com> writes:
> > For some reason, I can't get the index to be used on the table sitting
> > under a view during a join, even though it should be, or at least it
> > seems....
>
> Nope, that's not going to work, because the aggregate keeps the subquery
> from being flattened into the upper query, which is what would have to
> happen for a nestloop-with-inner-indexscan join to be considered.
> AFAICS you've got to structure it so that the aggregation happens above
> the join.

right, i see that it's actually the 'group by' that does it:

select a, b from foo join (select a, b from bar group by a,b) q using (a,b);

is enough to keep it from using the index on a,b from bar.  thats too bad...

merlin

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: join to view over custom aggregate seems like it should be faster
Next
From: Tom Lane
Date:
Subject: Re: join to view over custom aggregate seems like it should be faster