Number of attributes in HeapTupleHeader - Mailing list pgsql-hackers

From Manfred Koizar
Subject Number of attributes in HeapTupleHeader
Date
Msg-id ld7bduco24snoum0l2p5pvjooc8443svk8@4ax.com
Whole thread Raw
Responses Re: Number of attributes in HeapTupleHeader
Re: Number of attributes in HeapTupleHeader
Re: Number of attributes in HeapTupleHeader
List 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@sss.pgh.pa.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?

ServusManfred


pgsql-hackers by date:

Previous
From: mlw
Date:
Subject: Re: Musings
Next
From: Neil Conway
Date:
Subject: Re: Number of attributes in HeapTupleHeader