pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <amitlan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reduce memory used by partitionwise joins
Date: Mon, 25 Mar 2024 09:07:57 +0000
Message-ID: <E1rogJA-005XlS-Ls@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5278d0a2e870c61f9374a7796b90e6f9f6a73638

Modified Files
--------------
src/backend/optimizer/path/joinrels.c | 36 +++++++++++++++++++++++++++++++++++
src/backend/optimizer/util/pathnode.c |  5 +++--
src/include/nodes/pathnodes.h         |  3 +++
3 files changed, 42 insertions(+), 2 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1rogJA-005XlS-Ls@gemulon.postgresql.org>
Permalink:  ../E1rogJA-005XlS-Ls@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rogJA-005XlS-Ls@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: amitlan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Reduce memory used by partitionwise joins
  In-Reply-To: <E1rogJA-005XlS-Ls@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox