summaryrefslogtreecommitdiff
path: root/src/include/optimizer
diff options
context:
space:
mode:
authorRichard Guo2024-07-29 02:35:51 +0000
committerRichard Guo2024-07-29 02:35:51 +0000
commit513f4472a4a0d294ca64123627ce7b48ce0ee7c1 (patch)
treec9874b77b9775e02b0ade8ce4e0c109177cc4db6 /src/include/optimizer
parentf47b33a19115f432ad80777db0d1350d23bb6cf5 (diff)
Reduce memory used by partitionwise joins
In try_partitionwise_join, we aim to break down the join between two partitioned relations into joins between matching partitions. To achieve this, we iterate through each pair of partitions from the two joining relations and create child-join relations for them. With potentially thousands of partitions, the local objects allocated in each iteration can accumulate significant memory usage. Therefore, we opt to eagerly free these local objects at the end of each iteration. In line with this approach, this patch frees the bitmap set that represents the relids of child-join relations at the end of each iteration. Additionally, it modifies build_child_join_rel() to reuse the AppendRelInfo structures generated within each iteration. Author: Ashutosh Bapat Reviewed-by: David Christensen, Richard Guo Discussion: https://postgr.es/m/CAExHW5s4EqY43oB=ne6B2=-xLgrs9ZGeTr1NXwkGFt2j-OmaQQ@mail.gmail.com
Diffstat (limited to 'src/include/optimizer')
-rw-r--r--src/include/optimizer/pathnode.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index 112e7c23d4e..f00bd55f393 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -346,6 +346,7 @@ extern Bitmapset *get_param_path_clause_serials(Path *path);
extern RelOptInfo *build_child_join_rel(PlannerInfo *root,
RelOptInfo *outer_rel, RelOptInfo *inner_rel,
RelOptInfo *parent_joinrel, List *restrictlist,
- SpecialJoinInfo *sjinfo);
+ SpecialJoinInfo *sjinfo,
+ int nappinfos, AppendRelInfo **appinfos);
#endif /* PATHNODE_H */