Re: Memory consumed by child SpecialJoinInfo in partitionwise join planning

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory consumed by child SpecialJoinInfo in partitionwise join planning
Date: 2023-10-03 13:12:28
Message-ID: CAExHW5s-FPmY2jhxk4yEN3AmXDyh15E1+Scaf=6zzyghspHEaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 29, 2023 at 8:36 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> IOW, something
> like the following would have sufficed:
>
> @@ -1735,6 +1735,10 @@ build_child_join_sjinfo(PlannerInfo *root,
> SpecialJoinInfo *parent_sjinfo,
> /*
> * free_child_sjinfo_members
> * Free memory consumed by members of a child SpecialJoinInfo.
> + *
> + * Only members that are translated copies of their counterpart in the parent
> + * SpecialJoinInfo are freed here. However, members that could be referenced
> + * elsewhere are not freed.
> */
> static void
> free_child_sjinfo_members(SpecialJoinInfo *child_sjinfo)
> @@ -1755,10 +1759,7 @@ free_child_sjinfo_members(SpecialJoinInfo *child_sjinfo)
> bms_free(child_sjinfo->syn_lefthand);
> bms_free(child_sjinfo->syn_righthand);
>
> - /*
> - * But the list of operator OIDs and the list of expressions may be
> - * referenced somewhere else. Do not free those.
> - */
> + /* semi_rhs_exprs may be referenced, so don't free. */
> }

Works for me. PFA patchset with these changes. I have still left the
changes addressing your comments as a separate patch for easier
review.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
0001-Report-memory-used-for-planning-a-query-in--20231003.patch text/x-patch 10.1 KB
0002-Reduce-memory-used-by-child-SpecialJoinInfo-20231003.patch text/x-patch 12.1 KB
0003-Address-Amit-s-comments-20231003.patch text/x-patch 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-10-03 13:32:11 Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag
Previous Message Amit Langote 2023-10-03 13:11:00 Re: remaining sql/json patches