Re: Vacuum: allow usage of more than 1GB of work mem

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Claudio Freire <klaussfreire(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Vacuum: allow usage of more than 1GB of work mem
Date: 2018-07-13 13:44:25
Message-ID: 9bf3fe70-7aac-cbf7-62f7-acdaa4306ccb@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13/07/18 01:39, Andrew Dunstan wrote:
> On 07/12/2018 06:34 PM, Alvaro Herrera wrote:
>> On 2018-Jul-12, Andrew Dunstan wrote:
>>
>>> I fully understand. I think this needs to go back to "Waiting on Author".
>> Why? Heikki's patch applies fine and passes the regression tests.
>
> Well, I understood Claudio was going to do some more work (see
> upthread).

Claudio raised a good point, that doing small pallocs leads to
fragmentation, and in particular, it might mean that we can't give back
the memory to the OS. The default glibc malloc() implementation has a
threshold of 4 or 32 MB or something like that - allocations larger than
the threshold are mmap()'d, and can always be returned to the OS. I
think a simple solution to that is to allocate larger chunks, something
like 32-64 MB at a time, and carve out the allocations for the nodes
from those chunks. That's pretty straightforward, because we don't need
to worry about freeing the nodes in retail. Keep track of the current
half-filled chunk, and allocate a new one when it fills up.

He also wanted to refactor the iterator API, to return one ItemPointer
at a time. I don't think that's necessary, the current iterator API is
more convenient for the callers, but I don't feel strongly about that.

Anything else?

> If we're going to go with Heikki's patch then do we need to
> change the author, or add him as an author?

Let's list both of us. At least in the commit message, doesn't matter
much what the commitfest app says.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2018-07-13 13:50:36 Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
Previous Message Andrey Borodin 2018-07-13 13:41:39 Re: GiST VACUUM