Re: Memory Alignment in Postgres

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Arthur Silva <arthurprs(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory Alignment in Postgres
Date: 2014-09-11 15:46:35
Message-ID: 20140911154635.GC11983@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-09-11 11:39:12 -0400, Tom Lane wrote:
> Even on Intel, I'd wonder what unaligned accesses do to atomicity
> guarantees and suchlike.

They pretty much kill atomicity guarantees. Atomicity is guaranteed
while you're inside a cacheline, but not once you span them.

> This is not a big deal for row data storage,
> but we'd have to be careful about it if we were to back off alignment
> requirements for in-memory data structures such as latches and buffer
> headers.

Right. I don't think that's an option.

> Another fun thing you'd need to deal with is ensuring that the C structs
> we overlay onto catalog data rows still match up with the data layout
> rules.

Yea, this would require some nastyness in the bki generation, but it'd
probably doable to have different alignment for system catalogs.

> On the whole, I'm pretty darn skeptical that such an effort would repay
> itself. There are lots of more promising things to hack on.

I have no desire to hack on it, but I can understand the desire to
reduce the space overhead...

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-09-11 15:46:48 Re: proposal: ignore null fields in not relation type composite type based constructors
Previous Message Pavel Stehule 2014-09-11 15:43:24 Re: proposal (9.5) : psql unicode border line styles