> Do people want the overhead of char(), varchar(), and text to be reduced
> from 4-bytes to 2-bytes. We store the length in this overhead, but
> since we have a size limit on tuple size, we can't have a field over 8k
> in size anyway. Even if we up that to 32k for 6.3, we still only use 2
> bytes.
>
> I have added it to the TODO list. Most of the code already supports it
> by using VARSIZE and VARDATA macros. Once the structure size changes,
> the macros change too. The only issue is places where they take the
> first four bytes of the variable-length type and cast it to an int32,
> which will not work in this case. We have to change this so it uses the
> macros too.
Would be a nice space-saver if you have tables with many small text fields.
Dig out that old message of mine concerning block size and check out item #4.
Excerpted below if you've finally deleted it... :) :)
> Date: Wed, 29 Jan 1997 13:38:10 -0500
> From: aixssd!darrenk (Darren King)
> Subject: [HACKERS] Max size of data types and tuples.
> ...
> 4. Since only 13 bits are needed for storing the size of these
> textual fields in a tuple, could PostgreSql use a 16-bit int to
> store it? Currently, the size is padded to four bytes in the
> tuple and this eats space if you have many textual fields.
> Without further digging, I'm assuming that the size is double-word
> aligned so that the actual text starts on a double-word boundary.
> ...
darrenk