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), [EMAIL PROTECTED] (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 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org