"Ryan Bradetich" <rbradetich@gmail.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