Skip to content

Commit

Permalink
Don't build partition info for local hypertables
Browse files Browse the repository at this point in the history
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 timescale#5596 we
have implemented our own code to push down partial aggregations.
Therefore, we can ignore the PostgreSQL setting from now on.
  • Loading branch information
jnidzwetzki committed Sep 14, 2023
1 parent ba9b818 commit 0ceb389
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 291 deletions.
6 changes: 2 additions & 4 deletions src/planner/expand_hypertable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Loading

0 comments on commit 0ceb389

Please sign in to comment.