Re: A potential memory leak on Merge Join when Sort node is not below Materialize node

From: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Önder Kalacı <onderkalaci(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: A potential memory leak on Merge Join when Sort node is not below Materialize node
Date: 2022-09-29 14:15:25
Message-ID: 2116700.irdbgypaU6@aivenronan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le jeudi 29 septembre 2022, 16:10:03 CEST Tom Lane a écrit :
> Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io> writes:
> >> Yeah, I think the same rules around scope apply as
> >> tuplesort_gettupleslot() with copy==false. We could do it by adding a
> >> copy flag to the existing function, but I'd rather not add the
> >> branching to that function. It's probably just better to duplicate it
> >> and adjust.
> >
> > For the record, I tried to see if gcc would optimize the function by
> > generating two different versions when copy is true or false, thus getting
rid
> > of the branching while still having only one function to deal with.
>
> TBH, I think this is completely ridiculous over-optimization.
> There's exactly zero evidence that a second copy of the function
> would improve performance, or do anything but contribute to code
> bloat (which does have a distributed performance cost).

I wasn't commenting on the merit of the optimization, but just that I tried to
get gcc to apply it itself, which it doesn't.

Regards,

--
Ronan Dunklau

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message PG Doc comments form 2022-09-29 14:30:13 request clarification on pg_restore documentation
Previous Message Bharath Rupireddy 2022-09-29 14:13:28 Re: Add LSN along with offset to error messages reported for WAL file read/write/validate header failures