Re: Memory Alignment in Postgres

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Memory Alignment in Postgres
Дата
Msg-id 18539.1410449952@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Memory Alignment in Postgres  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Memory Alignment in Postgres  (Andres Freund <andres@2ndquadrant.com>)
Re: Memory Alignment in Postgres  (Arthur Silva <arthurprs@gmail.com>)
Список pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> Be advised of the difficulties you are going to face here.  Assuming
> for a second there is no reason not to go unaligned on Intel and there
> are material benefits to justify the effort, that doesn't necessarily
> hold for other platforms like arm/power.

Note that on many (most?) non-Intel architectures, unaligned access is
simply not an option.  The chips themselves will throw SIGBUS or
equivalent if you try it.  Some kernels provide signal handlers that
emulate the unaligned access in software rather than killing the process;
but the performance consequences of hitting such traps more than very
occasionally would be catastrophic.

Even on Intel, I'd wonder what unaligned accesses do to atomicity
guarantees and suchlike.  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.

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.

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.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Patch to support SEMI and ANTI join removal
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: pg_background (and more parallelism infrastructure patches)