Re: Vectored I/O in bulk_write.c

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Vectored I/O in bulk_write.c
Date: 2024-03-13 10:22:20
Message-ID: f7e023ff-7621-41d0-97bb-a60a9ab08909@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13/03/2024 12:18, Thomas Munro wrote:
> On Wed, Mar 13, 2024 at 9:57 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>>> Here also is a first attempt at improving the memory allocation and
>>> memory layout.
>>> ...
>>> +typedef union BufferSlot
>>> +{
>>> + PGIOAlignedBlock buffer;
>>> + dlist_node freelist_node;
>>> +} BufferSlot;
>>> +
>>
>> If you allocated the buffers in one large contiguous chunk, you could
>> often do one large write() instead of a gathered writev() of multiple
>> blocks. That should be even better, although I don't know much of a
>> difference it makes. The above layout wastes a fair amount memory too,
>> because 'buffer' is I/O aligned.
>
> The patch I posted has an array of buffers with the properties you
> describe, so you get a pwrite() (no 'v') sometimes, and a pwritev()
> with a small iovcnt when it wraps around:

Oh I missed that it was "union BufferSlot". I thought it was a struct.
Never mind then.

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2024-03-13 11:04:51 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message Thomas Munro 2024-03-13 10:18:33 Re: Vectored I/O in bulk_write.c