Re: pgsql: Generational memory allocator

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Generational memory allocator
Date: 2017-11-26 19:09:02
Message-ID: CANP8+jLbnDbd4ShH5B27Y0fRxDn3i=Zij3pNfp6u4LSSg66zDA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 27 November 2017 at 05:53, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
>> On 27 November 2017 at 04:46, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

BLCKSZ/2 seems best then.

I guess that means palloc doesn't work well with BLCKSZ > 8192

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-11-26 19:42:54 Re: pgsql: Generational memory allocator
Previous Message Tom Lane 2017-11-26 18:53:37 Re: pgsql: Generational memory allocator