Re: Proposal : Use bump memory context for temp buffers

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal : Use bump memory context for temp buffers
Date: 2025-12-16 14:15:45
Message-ID: CAJDiXgi3ebdT4Vd8Djd=1PO_cPYASSeCgH283eS8BpBmpXSP8g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Dec 16, 2025 at 8:51 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> On 16/12/2025 15:05, Daniil Davydov wrote:
> > I think that it will be useful for temp buffers :
> > 1) We allocate them lazily and never try to free them.
> > 2) Some users are very active in working with temporary tables, and as
> > a result,
> > they set large values for the "temp_buffers" parameter (several gigabytes).
>
> It makes no difference. The bump memory context is useful if you perform
> a lot of small allocations, because it skips the overhead of the chunk
> headers. In LocalBufferContext, we only ever make one allocation.
>

Thanks for the explanation!

Actually, we allocate temp buffers gradually by memory chunks with
increasing size. So if temp buffers are pretty big, we must to do about 20
allocations.

I 100% agree that the amount of saved memory will be very-very low
compared to the size of the temp buffers. When I wrote "perfectly fit for bump
memory context" I meant design rather than the performance increasing.

--
Best regards,
Daniil Davydov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chengpeng Yan 2025-12-16 14:38:03 Re: Add a greedy join search algorithm to handle large join problems
Previous Message Heikki Linnakangas 2025-12-16 14:02:53 Re: [PATCH]Remove the redundant assignment