Re: [HACKERS] Partition-wise aggregation/grouping - Mailing list pgsql-hackers

From Jeevan Chalke
Subject Re: [HACKERS] Partition-wise aggregation/grouping
Date
Msg-id CAM2+6=X5XB_VHB6L+zBdQY=5nh_xDhNDkg6zGAU+YyetbG+HTA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Partition-wise aggregation/grouping  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] Partition-wise aggregation/grouping  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] Partition-wise aggregation/grouping  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers


On Sat, Mar 3, 2018 at 12:12 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Thu, Mar 1, 2018 at 4:52 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> This is not a full review, but I'm out of time for right now.

Another thing I see here now is that create_grouping_paths() and
create_child_grouping_paths() are extremely similar.  Isn't there some
way we can refactor things so that we can reuse the code instead of
duplicating it?

Yes. I too observed the same after our re-design.

To avoid code duplication, I am now calling create_grouping_paths() for child relation too.

However, to perform Gather or Gather Merge once we have all partial paths ready, and to avoid too many existing code rearrangement, I am calling try_partitionwise_grouping() before we do any aggregation/grouping on whole relation. By doing this, we will be having all partial paths in partially_grouped_rel and then existing code will do required finalization along with any Gather or Gather Merge, if required.

Please have a look over attached patch-set and let me know if it needs further changes.

Thanks


--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Attachment

pgsql-hackers by date:

Previous
From: Jeevan Chalke
Date:
Subject: Re: [HACKERS] Partition-wise aggregation/grouping
Next
From: Pavan Deolasee
Date:
Subject: Re: ON CONFLICT DO UPDATE for partitioned tables