From 29c78d7315c706ab3bbc2ddad91aa071929ce72d Mon Sep 17 00:00:00 2001 From: Jan Nidzwetzki Date: Tue, 12 Sep 2023 11:21:56 +0200 Subject: [PATCH] Don't build partition info for local hypertables So far, we have created fake partitioning info for hypertables if the PostgreSQL setting 'enable_partitionwise_aggregate' is set. This causes PostgreSQL to push down partial aggregations to the chunk level. However, the PostgreSQL code has some drawbacks because the query is replanned and optimizations like ChunkAppend are lost. Since #5596 we have implemented our own code to push down partial aggregations. Therefore, we can ignore the PostgreSQL setting from now on. --- src/planner/expand_hypertable.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/planner/expand_hypertable.c b/src/planner/expand_hypertable.c index 337b0b7c103..61f0156d05a 100644 --- a/src/planner/expand_hypertable.c +++ b/src/planner/expand_hypertable.c @@ -1381,10 +1381,8 @@ ts_plan_expand_hypertable_chunks(Hypertable *ht, PlannerInfo *root, RelOptInfo * /* Adding partition info will make PostgreSQL consider the inheritance * children as part of a partitioned relation. This will enable - * partitionwise aggregation. */ - if ((enable_partitionwise_aggregate && - !has_partialize_function((Node *) root->parse->targetList, TS_DO_NOT_FIX_AGGSPLIT)) || - hypertable_is_distributed(ht)) + * partitionwise aggregation for distributed queries. */ + if (hypertable_is_distributed(ht)) { build_hypertable_partition_info(ht, root, rel, list_length(inh_oids)); }