Number of attributes in HeapTupleHeader

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Number of attributes in HeapTupleHeader
Date: 2002-05-05 21:48:31
Message-ID: ld7bduco24snoum0l2p5pvjooc8443svk8@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently there's an int16 t_natts in HeapTupleHeaderData. This
number is stored on disk for every single tuple. Assuming that the
number of attributes is constant for all tuples of one relation we
have a lot of redundancy here.

Almost everywhere in the sources, where HeapTupleHeader->t_natts is
used, there is a HeapTuple and/or TupleDesc around. In struct
tupleDesc there is int natts /* Number of attributes in the tuple */.
If we move t_natts from struct HeapTupleHeaderData to struct
HeapTupleData, we'd have this number whenever we need it and didn't
have to write it to disk millions of times.

Two years ago there have been thoughts about ADD COLUMN and whether it
should touch all tuples or just change the metadata. Could someone
tell me, what eventually came out of this discussion and where I find
the relevant pieces of source code, please. What about DROP COLUMN?

If there is interest in reducing on-disk tuple header size and I have
not missed any strong arguments against dropping t_natts, I'll
investigate further. Comments?

On Fri, 3 May 2002 01:40:42 +0000 (UTC), tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
wrote:
> Now if
>we could get rid of 8 bytes in the header, I'd get excited ;-)

If this is doable, we arrive at 6 bytes. And what works for t_natts,
should also work for t_hoff; that's another byte. Are we getting
nearer?

Servus
Manfred

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2002-05-05 22:07:27 Re: Number of attributes in HeapTupleHeader
Previous Message mlw 2002-05-05 20:05:33 Re: Musings