pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: memory leak in trigger handling (since PG12)
Date: Thu, 25 May 2023 16:43:55 +0200
Message-ID: <0376ae2d-570e-8837-9e93-8ada1deb2cee@enterprisedb.com> (raw)
In-Reply-To: <20230524201915.4mb7xd2cw4k6epoy@awork3.anarazel.de>
References: <222a3442-7f7d-246c-ed9b-a76209d19239@enterprisedb.com>
	<960113.1684859980@sss.pgh.pa.us>
	<a5d42a2c-0c2e-9fb8-793f-0675d85669be@enterprisedb.com>
	<f706d912-b6fa-f1d7-5a39-dc1be5999183@enterprisedb.com>
	<20230524185559.un4dqfem3u3ktons@awork3.anarazel.de>
	<c3ff31ce-622c-81a9-9dcc-dbb27c5eaf9e@enterprisedb.com>
	<20230524201915.4mb7xd2cw4k6epoy@awork3.anarazel.de>

On 5/24/23 22:19, Andres Freund wrote:
>
> ...
> 
> Hm - stepping back a bit, why are we doing the work in ExecGetAllUpdatedCols()
> over and over?  Unless I am missing something, the result doesn't change
> across rows. And it doesn't look that cheap to compute, leaving aside the
> allocation that bms_union() does.
> 
> It's visible in profiles, not as a top entry, but still.
> 
> Perhaps the easiest to backpatch fix is to just avoid recomputing the value?
> But perhaps it'd be just as problmeatic, because callers might modify
> ExecGetAllUpdatedCols()'s return value in place...
> 

Yes, I think that's a perfectly valid point - I was actually wondering
about that too, but I was focused on fixing this in backbranches so I
left this as a future optimization (assuming it can be cached).


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





view thread (32+ messages)  latest in thread

Message-ID: <0376ae2d-570e-8837-9e93-8ada1deb2cee@enterprisedb.com>
Permalink:  ../0376ae2d-570e-8837-9e93-8ada1deb2cee@enterprisedb.com/
Also on:    postgresql.org/message-id/0376ae2d-570e-8837-9e93-8ada1deb2cee@enterprisedb.com

 · 

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-hackers@postgresql.org
  Cc: tomas.vondra@enterprisedb.com, andres@anarazel.de, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: memory leak in trigger handling (since PG12)
  In-Reply-To: <0376ae2d-570e-8837-9e93-8ada1deb2cee@enterprisedb.com>

* 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