On 2015/09/28 20:58, David Rowley wrote:
> On 28 September 2015 at 23:17, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
> wrote:
>> Moreover, would partial aggregation work below Append?
>>
>
> Do you mean for cases like:
>
> create table a as select x.x a from generate_series(1,1000000) x(x);
> select sum(a) from (select a from a union all select a from a) a;
>
> to allow the aggregation to happen before the append?
>
Yes.
> On testing this I do see that writing the query as:
>
> select sum(a) from (select sum(a) a from a union all select sum(a) from a)
> a;
>
> causes it to execute marginally faster. 174.280 ms vs 153.498 ms on my
> laptop.
> However pushing aggregation below Append nodes is not something I'm aiming
> to do for this patch.
I see. I recall reading in archives that pushing aggregates below append
was not found to make much difference as your little test suggests, too.
Thanks,
Amit