Re: Memory Alignment in Postgres - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Memory Alignment in Postgres
Date
Msg-id 20140911154635.GC11983@alap3.anarazel.de
Whole thread Raw
In response to Re: Memory Alignment in Postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal (9.5) : psql unicode border line styles
Next
From: Andrew Dunstan
Date:
Subject: Re: proposal: ignore null fields in not relation type composite type based constructors