Re: Memory consumed by child SpecialJoinInfo in partitionwise join planning
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-04T08:41:56Z
Lists: pgsql-hackers
Attachments
- 0002-Reduce-memory-used-by-child-SpecialJoinInfo-20230804.patch (text/x-patch) patch 0002
- 0001-Report-memory-used-for-planning-a-query-in--20230804.patch (text/x-patch) patch 0001
On Fri, Jul 28, 2023 at 7:28 PM Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> wrote: > > > > + bms_free(child_sjinfo->commute_above_l); > > + bms_free(child_sjinfo->commute_above_r); > > + bms_free(child_sjinfo->commute_below_l); > > + bms_free(child_sjinfo->commute_below_r); > > > > These four members in SpecialJoinInfo only contain outer join relids. > > They do not need to be translated. So they would reference the same > > memory areas in child_sjinfo as in parent_sjinfo. We should not free > > them, otherwise they would become dangling pointers in parent sjinfo. > > > > Attached patchset fixing those. 0001 - patch to report planning memory, with to explain.out regression output fix. We may consider committing this as well. 0002 - with your comment addressed above. > > I think we should 1. add an assert to make sure that commute_above_* > do not require any transations i.e. they do not contain any parent > relids of the child rels. Looking at the definitions of commute_above and commute_below relids and OJ relids, I don't think these assertions are necessary. So didn't add those. > 2. Do not free those. Done > 3. Add a comment about > keeping the build and free functions in sync. > Done. -- Best Wishes, Ashutosh Bapat
Commits
-
Code review for 6190d828cd2
- 0f7863afef67 17.0 landed
-
Do not translate dummy SpecialJoinInfos for child joins
- 6190d828cd25 17.0 landed
-
Reduce memory used by partitionwise joins
- 5278d0a2e870 17.0 landed
-
Remove dummy_spinlock
- 55627ba2d334 17.0 cited