Memory Alignment in Postgres - Mailing list pgsql-hackers

From Arthur Silva
Subject Memory Alignment in Postgres
Date
Msg-id CAO_YK0UzXZjyQdRt4PNWQ=R2udQug4FaW5HScE6nAhU8rC43Uw@mail.gmail.com
Whole thread Raw
Responses Re: Memory Alignment in Postgres
Re: Memory Alignment in Postgres
List pgsql-hackers
I'm continuously studying Postgres codebase. Hopefully I'll be able to make some contributions in the future.

For now I'm intrigued about the extensive use of memory alignment. I'm sure there's some legacy and some architecture that requires it reasoning behind it.

That aside, since it wastes space (a lot of space in some cases) there must be a tipping point somewhere. I'm sure one can prove aligned access is faster in a micro-benchmark but I'm not sure it's the case in a DBMS like postgres, specially in the page/rows area.

Just for the sake of comparison Mysql COMPACT storage (default and recommended since 5.5) doesn't align data at all. Mysql NDB uses a fixed 4-byte alignment. Not sure about Oracle and others.

Is it worth the extra space in newer architectures (specially Intel)?
Do you guys think this is something worth looking at?

I'm trying to messing with the *ALIGN macros but so far I wasn't able to get any conclusive results. My guess is that I'm missing something in the code or pg_bench doesn't stress the difference enough.

--
Arthur Silva

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: WIP Patch for GROUPING SETS phase 1
Next
From: Robert Haas
Date:
Subject: Re: bad estimation together with large work_mem generates terrible slow hash joins