Re: [HACKERS] Partition-wise aggregation/grouping

From: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: [HACKERS] Partition-wise aggregation/grouping
Date: 2018-01-11 11:00:48
Message-ID: CAM2+6=XsyG3=FRYePc6YBZ3VFJ9BRx66V-eBO257oC0d6F6bNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Thu, Dec 14, 2017 at 4:01 PM, Ashutosh Bapat <
> ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
>
>>
>> +
>> +-- Partial aggregation as GROUP BY clause does not match with PARTITION
>> KEY
>> +EXPLAIN (COSTS OFF)
>> +SELECT b, sum(a), count(*) FROM pagg_tab GROUP BY b ORDER BY 1, 2, 3;
>> + QUERY PLAN
>> +----------------------------------------------------------------
>> + Sort
>> + Sort Key: pagg_tab_p1.b, (sum(pagg_tab_p1.a)), (count(*))
>> + -> Finalize GroupAggregate
>> + Group Key: pagg_tab_p1.b
>> + -> Sort
>> + Sort Key: pagg_tab_p1.b
>> + -> Append
>> + -> Partial HashAggregate
>> + Group Key: pagg_tab_p1.b
>> + -> Seq Scan on pagg_tab_p1
>> + -> Partial HashAggregate
>> + Group Key: pagg_tab_p2_s1.b
>> + -> Append
>> + -> Seq Scan on pagg_tab_p2_s1
>> + -> Seq Scan on pagg_tab_p2_s2
>> + -> Partial HashAggregate
>> + Group Key: pagg_tab_p3_s1.b
>> + -> Append
>> + -> Seq Scan on pagg_tab_p3_s1
>> + -> Seq Scan on pagg_tab_p3_s2
>> +(20 rows)
>>
>> Why aren't we seeing partial aggregation paths for level two and below
>> partitions?
>>
>
>>
> In this version of the patch I have not recursed into next level.
> Will work on it and submit changes in the next patch-set.
>

Attached new set of patches adding this. Only patch 0007 (main patch) and
0008 (testcase patch) has changed.

>
Please have a look and let me know if I missed any.

Thanks
--
Jeevan Chalke
Technical Architect, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Attachment Content-Type Size
partition-wise-agg-v10.tar.gz application/x-gzip 37.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2018-01-11 11:07:59 Re: [HACKERS] UPDATE of partition key
Previous Message Alexander Korotkov 2018-01-11 11:00:45 Re: CUBE seems a bit confused about ORDER BY