Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()
Date: 2018-01-12 22:32:17
Message-ID: 20180112223217.d55lv4ntlwbskxn3@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

On 2018-01-12 17:24:54 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2018-01-12 10:45:54 -0500, Tom Lane wrote:
> >> The xl_prev field is our only way of detecting that we're looking at
> >> old WAL data when we cross a sector boundary.
>
> > Right. I wonder if it be reasonable to move that to a page's header
> > instead of individual records? To avoid torn page issues we'd have to
> > reduce the page size to a sector size, but I'm not sure that's that bad?
>
> Giving up a dozen or two bytes out of every 512 sounds like quite an
> overhead.

It's not nothing, that's true. But if it avoids 8 bytes in every record,
that'd probably at least as much in most usecases.

> Also, this'd mean that a much larger fraction of WAL records
> need to be split across page boundaries, which I'd expect to produce a
> performance hit in itself --- a page crossing has to complicate figuring
> out how much space we need for the record.

It does increase the computation a bit, see XLogBytePosToRecPtr(). I'd
guess that more of the overhead would come from the xlog buffer
management though.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2018-01-12 22:35:48 Re: [HACKERS] Refactoring identifier checks to consistently use strcmp
Previous Message Tom Lane 2018-01-12 22:24:54 Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()