Re: Add bump memory context type and use it for tuplesorts

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add bump memory context type and use it for tuplesorts
Date: 2024-03-25 14:53:12
Message-ID: 2488297.1711378392@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> writes:
> IMHO the idea of having a general purpose memory context and then also
> specialized memory contexts for particular allocation patterns is great,
> and we should embrace it. Adding more and more special cases into
> AllocSet seems to go directly against that idea, makes the code more
> complex, and I don't quite see how is that better or easier to use than
> having a separate BumpContext ...

I agree with this completely. However, the current design for chunk
headers is mighty restrictive about how many kinds of contexts we can
have. We need to open that back up.

Could we move the knowledge of exactly which context type it is out
of the per-chunk header and keep it in the block header? This'd
require that every context type have a standardized way of finding
the block header from a chunk. We could repurpose the existing
MemoryContextMethodID bits to allow having a small number of different
ways, perhaps.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pankaj Raghav 2024-03-25 15:06:04 Re: Large block sizes support in Linux
Previous Message Nathan Bossart 2024-03-25 14:47:43 Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs