Re: pgsql: Generational memory allocator - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Generational memory allocator
Date
Msg-id 28144.1511722417@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Generational memory allocator  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: pgsql: Generational memory allocator  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-committers
Simon Riggs <simon@2ndquadrant.com> writes:
> On 27 November 2017 at 04:46, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Well, I'm concerned about the possibility of a lot of palloc thrashing
>> if the first bunch of records it reads happen to have steadily increasing
>> sizes.  However, rather than doubling, it might be sufficient to set a
>> robust minimum on the first allocation, ie use something along the lines
>> of Max(1024, MAXALIGN(state->main_data_len)).

> Agreed.

> I was just researching what that number should be... and I was
> thinking that we should use the maximum normal tuple size, which I
> think is

> TOAST_TUPLE_THRESHOLD +
> SizeOfXLogRecord +
> SizeOfXLogRecordDataHeaderLong

Well, let's not overthink this, because anything under 8K is going to
be rounded up to the next power of 2 anyway by aset.c.  Based on this
point I'd say that BLCKSZ/2 or BLCKSZ/4 would be reasonable candidates
for the minimum.
        regards, tom lane


pgsql-committers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: pgsql: Generational memory allocator
Next
From: Simon Riggs
Date:
Subject: Re: pgsql: Generational memory allocator