Reduce memory used by partitionwise joins
Amit Langote <amitlan@postgresql.org>
Reduce memory used by partitionwise joins Specifically, this commit reduces the memory consumed by the SpecialJoinInfos that are allocated for child joins in try_partitionwise_join() by freeing them at the end of creating paths for each child join. A SpecialJoinInfo allocated for a given child join is a copy of the parent join's SpecialJoinInfo, which contains the translated copies of the various Relids bitmapsets and semi_rhs_exprs, which is a List of Nodes. The newly added freeing step frees the struct itself and the various bitmapsets, but not semi_rhs_exprs, because there's no handy function to free the memory of Node trees. Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Reviewed-by: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Amit Langote <amitlangote09@gmail.com> Reviewed-by: Andrey Lepikhov <a.lepikhov@postgrespro.ru> Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com> Discussion: https://postgr.es/m/CAExHW5tHqEf3ASVqvFFcghYGPfpy7o3xnvhHwBGbJFMRH8KjNw@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/path/joinrels.c | modified | +36 −0 |
| src/backend/optimizer/util/pathnode.c | modified | +3 −2 |
| src/include/nodes/pathnodes.h | modified | +3 −0 |
Discussion
- Memory consumed by child SpecialJoinInfo in partitionwise join planning 35 messages · 2023-07-27 → 2024-03-25