Re: reducing planner memory usage #1 - simpler patches

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: reducing planner memory usage #1 - simpler patches
Date: 2026-12-05 16:21:59
Message-ID: CAGRkXqQOSYSBDK+E7t3iF20rBxDb2AKvvAAO-+ooy1SjSCY5xA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tomas,

I reviewed 001-003 this morning.I think they are all correct.

One more spot in generate_mergejoin_paths() still leaks per outer path.
That is the trialsortkeys copy and the newclauses list from
trim_mergeclauses_for_inner_pathkeys(). Freeing both takes your STAR2
reproducer from 45509 kB to 41348 kB, with the same plan. The attached
nocfbot patch does that, maybe fold it into 0001?

> These patches are freeing lists from *rejected paths* (mergejoin and
> hashjoin). The patches do that in add_path() but that seems a bit dirty.
> It relies on the fact that the path can't be reference by anything, and
> while I think that's true, maybe it isn't?

I think no core caller keeps a rejected MergePath or HashPath.
Also, GetExistingLocalJoinPath() only copies paths already in the pathlist.

Attachment Content-Type Size
nocfbot-v1-0001-fixup-free-mergejoin-trial-lists.patch application/octet-stream 1.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-12-05 16:31:57 Re: FULL JOIN planning failure with virtual generated columns
Previous Message shihao zhong 2026-12-05 16:14:10 Re: Compute the distance between a point and a box exactly