Re: [WIP] Reduce alignment requirements on 64-bit systems.

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: "Ryan Bradetich" <rbradetich(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [WIP] Reduce alignment requirements on 64-bit systems.
Date: 2008-10-09 12:01:10
Message-ID: 20081009204749.188B.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Ryan Bradetich" <rbradetich(at)gmail(dot)com> wrote:

> Here is a proof-of-concept patch for reducing the alignment
> requirement for heap tuples on 64-bit systems.
>
> pg_depend 312 kB 296 kB
> pg_description 160 kB 152 kB

5 percent of gain seems reasonable for me.
Is it possible to apply your improvement for indexes?
I think there are more benefits for small index entries
that size are often 12 or 20 bytes.

> This would completely eliminate the impact for this
> patch on 32-bit systems, which would not gain any benefit from this patch.

No! There are *also* benefits even on 32-bit systems, because some
of them have 8-byte alignment. (for example, 32-bit Windows)

BTW, there might be a small mistabke on the following lines in patch.
They do the same things ;-)

***************
*** 1019,1025 **** toast_flatten_tuple_attribute(Datum value,
new_len += BITMAPLEN(numAttrs);
if (olddata->t_infomask & HEAP_HASOID)
new_len += sizeof(Oid);
! new_len = MAXALIGN(new_len);
Assert(new_len == olddata->t_hoff);
new_data_len = heap_compute_data_size(tupleDesc,
toast_values, toast_isnull);
--- 1025,1034 ----
new_len += BITMAPLEN(numAttrs);
if (olddata->t_infomask & HEAP_HASOID)
new_len += sizeof(Oid);
! if (olddata->t_infomask & HEAP_INTALIGN)
! new_len = MAXALIGN(new_len);
! else
! new_len = MAXALIGN(new_len);
Assert(new_len == olddata->t_hoff);
new_data_len = heap_compute_data_size(tupleDesc,
toast_values, toast_isnull);

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-10-09 12:37:41 Re: CREATE DATABASE vs delayed table unlink
Previous Message Heikki Linnakangas 2008-10-09 10:38:38 Re: CREATE DATABASE vs delayed table unlink