Re: Another planner/optimizer question... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Another planner/optimizer question...
Date
Msg-id 21781.1004628155@sss.pgh.pa.us
Whole thread Raw
In response to Another planner/optimizer question...  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: Another planner/optimizer question...
List pgsql-hackers
Philip Warner <pjw@rhyme.com.au> writes:
> Is there any way to get PG to know that it only needs to do the
> aggregate once?

It'd probably be possible to look for duplicated aggrefs being assigned
to the same Agg plan node during planning.  However, I'm not entirely
convinced that it's worth the trouble --- the individual transition
function calls are not usually all that expensive.

But ... the example you are offering has nothing to do with aggregates.
Subplans are a different and much messier deal.  The best I could offer
you (short of a complete redesign of subqueries) would be to not pull up
views that have any subqueries, which would probably be a net loss.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Tille, Andreas"
Date:
Subject: Re: Serious performance problem
Next
From: Tom Lane
Date:
Subject: Re: Posgresql 7.2b1 crashes